androidpdfprinting

Print existing pdf file in android


Hey everyone so I am trying to build a small sample printing app on android and can't seem to print an existing pdf. There is plenty of documentation on creating a custom document with the canvas but I already have the document. Basically I just want to be a able to read in a pdf document and send it as a file output stream directly to the printer to be printed. Any help is appreciated.


Solution

  • Basically I just want to be a able to read in a pdf document and send it as a file output stream directly to the printer to be printed.

    That's not strictly possible, unless you find some particular printer that offers such an API for Android.

    If you wish to use the Android printing framework, you will need to create a PrintDocumentAdapter that can handle your existing PDF file. This sample project demonstrates one such PrintDocumentAdapter, though it is not general-purpose.