Closed varan-raj closed 1 year ago
At present, swissqrcode is not supported. I did not foresee the need for clipping functionality when generating barcodes,
Hi,
Thanks for the Information, Could you please suggest any Node js which supports the swiss QR code Type(not Swiss bill only QR code)
I am not aware of any package that does so.
@metafloor do you have plans on supporting Swiss QR code?
Version 3.0.4 has experimental support for swissqrcode. If you use it, test thoroughly for your use cases. The clipping and drawing of the swiss cross uses a scaling factor that is not related to module width, so the drawing code has to make special accommodations.
A sample usage:
const fs = require('fs');
const bwipjs = require('bwip-js');
// Per section 4.1.4, EOL should be <CRLF>, omitted on last line.
function swissqr(string) {
return string.replace(/\r\n|[\r\n]/g, '\r\n')
.replace(/(\r\n)+$/,'')
.replace(/(^|\r\n)[ \t]+/g, '$1');
}
bwipjs.toBuffer({
// text from section 4.4 QR-bill "DO NOT USE FOR PAYMENT"
bcid: 'swissqrcode',
text: swissqr(`SPC
0200
1
CH4431999123000889012
S
Max Muster & Söhne
Musterstrasse
123
8000
Seldwyla
CH
0.00
CHF
S
Simon Muster
Musterstrasse
1
8000
Seldwyla
CH
QRR
210000000003139471430009017
DO NOT USE FOR PAYMENT
EPD`),
}).then((buf) => {
fs.writeFileSync('swissqr.png', buf);
}).catch((err) => {
console.log(err.stack || err);
});
What is the status on this, is Swiss QR code support in a more advanced state now than "experimental"?
Swiss QR Code is now fully supported in v3.2.0.
Hi,
I am using the latest version of bwip-js (3.0.0), while trying to generate the swissqrcode using the function(bwipp_swissqrcode()), I faced an issue stating that the clip($$.clip()) and setrgbcolor( $$.setrgbcolor(0, 0, 0)) is not a function in the console as error, due to which i am unable to generate the expected QR code. Request you to help me on this. Thanks in Advance
Regards, Varan