Question

I'm working on a simple phonegap app that prints a simple pdf page to test Google cloud printing, I followed steps mentioned here.
It's working fine in a browser but when I tried it on a mobile, nothing was printed, I wasn't even able to save it to my Google drive.
Here is my code:

var gadget = new cloudprint.Gadget();
gadget.setPrintDocument("url", "Test Page",
       "http://www.google.com/landing/cloudprint/testpage.pdf");
gadget.openPrintDialog();
Was it helpful?

Solution

I faced this issue too, it can be solved using a simple http request. at first you have to add InAppBrowser, then you can use this plugin for printing, it supports Google Cloud Print on Android and AirPrint on iOS

after adding printing plugin, it can be used as below:

var type = "text/html"
var title = "test.html";
var fileContent = "<html>Phonegap Print Plugin</html>";
window.PrintPlugin.print(fileContent,function(){console.log('success')},function(){console.log('fail')},"",type,title);

OTHER TIPS

at first it didn't work with me then I added Device plugin to make it work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top