Mohamed Salah
Mohamed Salah

Reputation: 1502

google cloud print not working with phonegap

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

Upvotes: 2

Views: 1975

Answers (2)

user3111020
user3111020

Reputation: 66

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

Upvotes: 1

Hazem Hagrass
Hazem Hagrass

Reputation: 9808

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

Upvotes: 2

Related Questions