Hello, currently the library doesn't support printing pdf in firefox, but there is supposed to be working that instead of printing the pdf, it opens in a new tab, well, appareantly it doesn't work if you are trying to use a base64 pdf string with the latest release v1.0.55
It gives me:
TypeError: window.open(...) is null
Hey Pablo, thanks for reporting this.
The base64 option is a new feature that just got added. I honestly didn't think about the unsupported browser scenario when implementing this. It needs to be handled.
I needed a workaround, i got it working this way if someone else needs it.
_pdf_ is the base64 encoded pdf string
printjs({
printable: new Buffer(pdf, "base64"),
type: "pdf",
base64: true,
fallbackPrintable: `data:application/pdf;base64,${pdf}`,
});
Hey @PabloSzx, this is now built into the library. It will be published to npm with the next release.
https://github.com/crabbly/Print.js/commit/01f9d0635587f498f5342d615592c586701d8aca
Thank you for your help!
The new version has been published to npm with better support for base64 pdf.
https://github.com/crabbly/Print.js/releases/latest
Run npm update print-js to get it.
Please report any issues.
Thank you, Pablo.
Hello, I'm not able to print the base64 string in m chrome browser, by way it is not throwing any error that makes me a headache. let me know if you need more info.
Thanks.