Send text
Minimal Kotlin example. device_id accepts values from 1 to 5.
kotlin
val intent = Intent(Intent.ACTION_SEND).apply { type = "text/plain" setPackage("com.fidelier.posprinterdriver") putExtra(Intent.EXTRA_TEXT, "Order #123Total: 12,50 €") putExtra("device_id", 1)}startActivity(intent)- First check that the selected printer exists and passes the built-in test.
- Special text commands are explained in the command reference.
Send an image
Share a content:// URI through FileProvider and grant temporary read permission.
kotlin
val intent = Intent(Intent.ACTION_SEND).apply { type = "image/png" setPackage("com.fidelier.posprinterdriver") putExtra(Intent.EXTRA_STREAM, imageUri) putExtra("device_id", 1) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)}startActivity(intent)- The app may show a preview and allow printer selection.
- The extra option direct with value "1" skips preview in the supported flow; test it explicitly with your version.
Send a PDF
kotlin
val intent = Intent(Intent.ACTION_SEND).apply { type = "application/pdf" setPackage("com.fidelier.posprinterdriver") putExtra(Intent.EXTRA_STREAM, pdfUri) putExtra("device_id", 1) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)}startActivity(intent)Checks before release
- Handle cases where PosPrinterDriver is not installed.
- Use content:// URIs and temporary permissions; do not expose private filesystem paths.
- Test large images, transparency and orientation.
- Test accented characters and the selected code page.
- Avoid automatic retries that could duplicate tickets.