upn-with-qr-generator
v1.0.4
Published
A UPN + QR code generator for Slovenian banking system
Downloads
379
Maintainers
Readme
UPN Generator
A TypeScript library for generating UPN + QR codes for Slovenian banks, complete with customizable fields and QR code export options. Essentially just a javascript rewrite of this PHP library with the same functionality.
Installation
Install via npm:
npm install upn-with-qr-generator
Usage
import { UPNGenerator, UPNWriter } from 'upn-generator';
// Define UPN data
const upnData = {
payerName: 'Janez Novak',
payerAddress: 'Dunajska ulica 1',
payerPost: '1000 Ljubljana',
receiverName: 'RentaCar d.o.o.',
receiverAddress: 'Pohorska ulica 22',
receiverPost: '2000 Maribor',
receiverIban: 'SI56020170014356205',
amount: 300.24,
code: 'RENT',
reference: 'SI121234567890120',
purpose: 'Plačilo najemnine za marec',
dueDate: '20231001' // Format YYYYMMDD
};
// Create a UPN writer
const upnWriter = new UPNWriter(upnData);
// Save as PNG
upnWriter.saveAsPNG('./output/UPNFinal.png');
// Get as base64 string
upnWriter.png().then(base64String => {
console.log('Base64 PNG:', base64String);
});
// Get as image buffer
upnWriter.gdResource().then(buffer => {
console.log('Image Buffer:', buffer);
});
Above example will output:
License
The MIT License (MIT). Please see License File for more information.