문제

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