Package Exports
- swiss-qr-invoice-js
- swiss-qr-invoice-js/build/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swiss-qr-invoice-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
swiss-qr-invoice-js
creates π¨π qr invoices using pdfkit
Can't wait to use it? Feel free to contribute.
π Table of Contents
π§ About
swiss-qr-invoice-js is a library that generates π¨π QR payment sections. It is capable to either generate a PDF file from scratch or attach the section to a given PDFkit document instance.
π Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Installing
Install the package via npm:
npm install swiss-qr-invoice-js --saveor via yarn:
yarn add swiss-qr-invoice-jsπ Usage
Basic usage
import QRInvoice from 'swiss-qr-invoice-js';
const invoice = new QRInvoice()
.setAmount(100.0)
.setCurrency('CHF')
.setCreditor({
name: 'Cytex GmbH',
address: 'Musterstrasse 1',
zip: '8000',
city: 'ZΓΌrich',
country: 'CH',
iban: 'CH9300762011623852957',
reference: '123456789012345678901234567',
})
.setDebtor({
name: 'Max Muster',
address: 'Musterstrasse 2',
zip: '8000',
city: 'ZΓΌrich',
country: 'CH',
})
.setReference('123456789012345678901234567')
.setAdditionalInformation('Rechnung 2021-01');
// Generate a PDF file
invoice.save('invoice.pdf');
// Attach the QR invoice to an existing PDF document
const pdfDocument = new PDFDocument();
invoice.attachToPDF(pdfDocument);π§ Running the tests
Tests are written with jest. You can run them with the following command:
npm run testβοΈ Built Using
- PDFKit - PDF generation library
- TypeScript - Programming language
- Jest - Testing framework
- Prettier - Code formatter
- ESLint - Linter
βοΈ Authors
- @cytex-ch - Project author
- @sjutz - Project maintainer simon.jutz@cytex.ch