Document Printing from Mobile App Implementation

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Document Printing from Mobile App Implementation
Simple
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Document Printing from Mobile Applications

Printing from mobile app — task underestimated until first crash report from zero printers or inability to print PDF on competing vendor printer. Proper implementation requires understanding three independent channels: system Print Framework, AirPrint/Mopria, direct printing via vendor SDK.

Android: Print Framework and Limitations

Android provides PrintManager + PrintDocumentAdapter — standard path with system printer selection. Works via PrintService plugins: Google Cloud Print obsolete, Mopria Print Service — current standard for Wi-Fi printers.

For PDF printing:

val printManager = getSystemService(Context.PRINT_SERVICE) as PrintManager
val jobName = "Document_${System.currentTimeMillis()}"
printManager.print(jobName, object : PrintDocumentAdapter() {
    override fun onLayout(oldAttr: PrintAttributes?, newAttr: PrintAttributes,
                          cancellationSignal: CancellationSignal,
                          callback: LayoutResultCallback, extras: Bundle?) {
        if (cancellationSignal.isCanceled) { callback.onLayoutCancelled(); return }
        val info = PrintDocumentInfo.Builder(jobName)
            .setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT)
            .setPageCount(pageCount)
            .build()
        callback.onLayoutFinished(info, oldAttr != newAttr)
    }
    override fun onWrite(pages: Array<out PageRange>, destination: ParcelFileDescriptor,
                         cancellationSignal: CancellationSignal, callback: WriteResultCallback) {
        // Write PDF bytes to destination.fileDescriptor
    }
}, null)

Main issue: PrintDocumentAdapter works with ParcelFileDescriptor. Pass ready PDF — copy bytes via FileOutputStream. PdfDocument from Android SDK suits simple docs; for complex — iText7 or HTML rendering via WebView.createPrintDocumentAdapter().

WebView.createPrintDocumentAdapter() — underrated tool. HTML + CSS → WebView → PrintDocumentAdapter. Supports @media print, page-break-before, @page { size: A4 }. For invoice templates, acts, labels — simpler than Canvas drawing.

iOS: AirPrint and UIPrintInteractionController

iOS printing via UIPrintInteractionController. Supports UIPrintInfo for setup (duplex, orientation) and multiple content types: UIPrintingItem (file URL), UIPrintPageRenderer (custom rendering).

let printController = UIPrintInteractionController.shared
let printInfo = UIPrintInfo(dictionary: nil)
printInfo.jobName = "Invoice"
printInfo.outputType = .general
printController.printInfo = printInfo
printController.printingItem = pdfURL // URL to local PDF
printController.present(animated: true)

AirPrint works without setup — iOS discovers printers automatically via Bonjour. Issue: printer must support AirPrint. Most corporate Canon, HP, Epson — support. Old models — no.

Direct Printing on Label Printers

Warehouse and retail apps need Zebra ZPL or TSC TSPL printing. System Print Framework won't help — need direct TCP/IP or Bluetooth.

Zebra Link-OS SDK for Android: ZebraPrinter via Connection (TCP or Bluetooth). Send ZPL template:

val connection = TcpConnection("192.168.1.100", 9100)
connection.open()
val printer = ZebraPrinterFactory.getInstance(connection)
printer.sendCommand("^XA^FO50,50^A0N,30,30^FDHello World^FS^XZ")
connection.close()

ZPL templates conveniently stored on server, fill via String.format() or Mustache. For dynamic barcodes — ^BC (Code128) or ^BQ (QR) ZPL commands.

Approach Selection by Scenario

Scenario Approach
A4 documents (invoices, acts) WebView → PrintDocumentAdapter / AirPrint
PDF from server PrintDocumentAdapter with ParcelFileDescriptor / UIPrintInteractionController
Zebra ZPL labels Zebra Link-OS SDK, direct TCP
Thermal printer receipts ESCPOS via Bluetooth or TCP
POS receipts (54-ФЗ) ATOL SDK / Evotry SDK

Document printing implementation: 1–3 weeks depending on printer type and template complexity.