Search code examples
javascriptcordovapdfinappbrowser

How to print PDF data from InAppBrowser (PhoneGap)


I am using PhoneGap / Steroids for an iOS app.

In PhoneGap, I request a pdf from the server. The pdf is received in base64 format.

I am able to successfully preview the pdf using InAppBrowser:

window.open( "data:application/pdf;base64," + pdf.data, "_blank" );

However what I really need is to send this pdf data to the printer via AirPrint. Is it possible to do this using InAppBrowser? If not, what is the recommended method?

Thanks (in advance) for your help


Solution

  • Well, I don't think there is any use for InAppBrowser for this purpose. What you should look instead is for plugin that connects to AirPrint such as Cordova Print Plugin. This allows you to connect to AirPrint from within your JavaScript code. I'm not sure about if it fits all of your purposes, though, but take a look.