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();
有帮助吗?

解决方案

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);

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top