Hi,
I’m looking for a printer plugin for capacitor.
Am I correct in saying that there is no print plugin for Capacitor?
I’ve searched the forum but only ever found something about cordova printer plugins, never something about capacitor printer plugins.
If I’m wrong, I would be very happy about a few hints.
However, I haven’t had great success with this plugin. In my case I am trying to print a pdf that was converted to base64.
The awesome-cordova-plugins/printer is based on this cordova-plugin-printer. This plugin has not been updated for quite some time and uses outdated Android libraries. I found a fork of this library, (forked cordova-plugin-printer) that resolved the outdated Android libaries.
I am really hoping capacitor team will make an official plugin to finally replace the cordova printer. Or at least provide some documentation of a workaround of some kind.
ok, im not a sponsorware.
But i like prove it is work on sunmi v2 hardware to print in a local printer.
however, i try import the package an when run npm i have error.
use ionic 8 y angular 17.
thankyou!!
Hi I had the same issue, I got awesome cordova plugins printer to work after some issues. For what it is worth I was created a PDF base64 from pdfmake but when I went to print it with the cordova plugin it was just printing a string of text even though it was a base64. Root cause it needs to have appended a like this “base64://”.
After fixing that works a like charm. I am using on Capacitor 6 and Ionic Angular 8 without issues.
Working code below
pdfMake.createPdf(pdfCreate).getBase64((base64Str) => {
this.printer.print("base64://"+base64Str.split('base64,'));
// or if using straight js => cordova.plugins.printer.print("base64://"+base64Str.split('base64,'))
});