Print html file in ionic framework using cordova

Hey guys is their any plugin which can help me print file from android using cordova.

I have tried to use katzer’s printer plugin but my application get cashed. Is their any better plugin or solution?

Doesn’t seem like there is. Have you tried using ngcordova with it?

http://ngcordova.com/docs/#Printer

Also, are you using the right branch? Seems that there are particular branches for different os versions

@Jailtas

The stable version doesn’t work with Ionic. However the master branch does.

Add the plugin:

cordova plugin add https://github.com/katzer/cordova-plugin-printer.git

Ionic version: beta-14
Checkout: https://github.com/katzer/cordova-plugin-printer/commit/1c5b0314e76d73d3f492a4c4c41f1703d9b3f9b6

I’m using it with Ionic version: beta-13 and is working fine if your print simple html.

I’m facing problems printing two things:

  • img tag with a src provided by canvas.toDataUrl
  • html with braces. Ex. <p>Customer id: {{customer.id}}</p>

Both contents do not get printed well with cordova printer, but perfect with normal window.print in a browser.

Any suggestions?

Regards!

The print option dialog is hidden with the stable version of the printer.

Back your problem. You can try to take a screenshot of the current page with cordova-screenshot.

I have same issue, but I am using Ionic Framework for my web appplication. Is there any way to print web page that lie within ion-view.

I’m having this issue also. It seems to be related to this issue opened on the Github repo. https://github.com/katzer/cordova-plugin-printer/issues/28

If I try to add the plugin from the master branch it causes my websocket connection to break. Probably not directly related. I think it has something to do with the order things are loaded in my index.html.