Closed eberhard-loesch closed 2 years ago
Hi Eberhard
This seems to be an issue with the standalone version of PDFKit that this library is currently using. The upcoming v3 will no longer use the prebuilt standalone version of PDFKit and your code is going to work fine. I hope that I will be able to finish v3 this weekend.
In the meantime, i found a workaround:
const SwissQRBill = require("swissqrbill");
const fs = require("fs");
const data = {
currency: "CHF",
amount: 1199.95,
reference: "210000000003139471430009017",
creditor: {
name: "Robert Schneider AG",
address: "Rue du Lac 1268",
zip: 2501,
city: "Biel",
account: "CH4431999123000889012",
country: "CH"
},
debtor: {
name: "Pia-Maria Rutschmann-Schnyder",
address: "Grosse Marktgasse 28",
zip: 9400,
city: "Rorschach",
country: "CH"
}
};
const pdfA4 = new SwissQRBill.PDF(data, "qrbill.pdf", { "autoGenerate": false, "size": "A4", "language": "DE" });
const logo = fs.readFileSync("my-logo.png");
pdfA4.image("data:image/png;base64," + logo.toString("base64"), 320, 145, { width: 200, height: 100 });
pdfA4.end();
Hi Roger Great, thanks a lot for your fast response and the workaround - it works perfect! Now I can embed PNG images to my QRbill. Kind regards Eberhard
Hi there First of all - thanks for provding this wonderfil package. I want to embed a JPG/PNG image into the header section of my SWISSQRBILL instead of using vector-graphics. I try do this by using the ".image" function (known from PDFkit). Maybe I'm using it not correctly - each time I invoke it I get an error (see error.txt).
How to embed a JPG/PNG image into the SwissQRbill?
Thanks for your reply & kind regards Eberhard
qrbill.js.txt error.txt