Skip to content

Commit

Permalink
Merge pull request #45 from Rogerrrrrrrs/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
schoero authored Apr 13, 2020
2 parents 413d6af + eb2974b commit 51415b1
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 49 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# SwissQRBill

![MIT License](https://img.shields.io/npm/l/swissqrbill?color=brightgreen)
![Dependencies](https://img.shields.io/david/rogerrrrrrrs/swissqrbill)
![Downloads](https://img.shields.io/npm/dw/swissqrbill)
![Issues](https://img.shields.io/github/issues-raw/rogerrrrrrrs/swissqrbill)
![Version](https://img.shields.io/npm/v/swissqrbill?color=brightgreen)
![CI](https://github.com/Rogerrrrrrrs/SwissQRBill/workflows/CI/badge.svg?branch=development)
<a href="https://github.com/Rogerrrrrrrs/SwissQRBill/blob/master/LICENSE">
<img alt="MIT License" src="https://img.shields.io/npm/l/swissqrbill?color=brightgreen">
</a>
<a href="https://www.npmjs.com/package/swissqrbill">
<img alt="Version" src="https://img.shields.io/npm/v/swissqrbill?color=brightgreen">
</a>
<a href="https://github.com/Rogerrrrrrrs/SwissQRBill/issues">
<img alt="Issues" src="https://img.shields.io/github/issues-raw/rogerrrrrrrs/swissqrbill">
</a>
<a href="https://www.npmjs.com/package/swissqrbill">
<img alt="Dependencies" src="https://img.shields.io/david/rogerrrrrrrs/swissqrbill">
</a>
<a href="https://www.npmjs.com/package/swissqrbill">
<img alt="Downloads" src="https://img.shields.io/npm/dw/swissqrbill">
</a>
<a href="https://github.com/Rogerrrrrrrs/SwissQRBill/actions?query=workflow%3ACI">
<img alt="CI" src="https://github.com/Rogerrrrrrrs/SwissQRBill/workflows/CI/badge.svg?branch=development">
</a>

With SwissQRBill you can easily generate the new QR Code payment slips that will be introduced in Switzerland on June 30, 2020.

Expand Down Expand Up @@ -40,7 +52,7 @@ npm i swissqrbill --save

## Quick start

It's quite easy to create a simple QR bill. All you have to do is create a new `SwissQRBill.PDF` instance and pass our data as first parameter and our output path as second parameter.
It's quite easy to create a simple QR bill. All you have to do is create a new `SwissQRBill.PDF` instance and pass your billing data object as the first parameter and your output path as the second parameter.

```js
const SwissQRBill = require("swissqrbill");
Expand Down Expand Up @@ -69,8 +81,8 @@ const data = {
const pdf = new SwissQRBill.PDF(data, "qrbill.pdf");
```

This will create the above PDF file. We can pass an optional third parameter that contains options like language or size etc.
Complete documentation for all methods and parameters can be found in [doc/api.md](https://github.com/Rogerrrrrrrs/SwissQRBill/blob/master/doc/api.md).
This will create the above PDF file. You can pass an optional third parameter that contains options like language or size etc.
A complete documentation for all methods and parameters can be found in [doc/api.md](https://github.com/Rogerrrrrrrs/SwissQRBill/blob/master/doc/api.md).

<br/>

Expand Down
8 changes: 5 additions & 3 deletions doc/how-to-create-a-complete-bill.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Introduction

In this munual you will learn how you can use SwissQRBill to create a complete PDF file and then attach the QR slip to the bottom of the page. We will use some methods from the PDFKit module as well as some methods from SwissQRBill which extends PDFKit functionality with different methods.
In this manual you will learn how you can use SwissQRBill to create a complete PDF file and then attach the QR slip to the bottom of the page. We will use some methods from the PDFKit module as well as some methods from SwissQRBill which extends PDFKit functionality with different methods.

The methods used from PDFKit are documented on [pdfkit.org](http://pdfkit.org/docs/getting_started.html)<br/>
The methods used from SwissQRBill are documented in the [API documentation](https://github.com/Rogerrrrrrrs/SwissQRBill/blob/master/doc/api.md).
Expand Down Expand Up @@ -54,7 +54,7 @@ Once we have our data ready we can create a new instance of `SwissQRBill` and st

```js

const pdf = new SwissQRBill.PDF(data as SwissQRBill.data, "complete-qr-bill.pdf", { autoGenerate: false, size: "A4" });
const pdf = new SwissQRBill.PDF(data, "complete-qr-bill.pdf", { autoGenerate: false, size: "A4" });
```

Please note that we have set `autoGenerate` to `false` and `size` to `A4`.
Expand Down Expand Up @@ -85,9 +85,11 @@ pdf.addPath(logoText, pdf.mmToPoints(20), pdf.mmToPoints(14))

```

We use the `mmToPoints()` method to place the logo 2cm from the left side and 14mm from the top. Then we fill the path with our colors.

### Adding the addresses

Next, we add the address of our business and the customer address to the PDF.
Next, we add the address of our business and the customer address to the PDF. You can use `\n` to create a new line.

```js
pdf.fontSize(12);
Expand Down
123 changes: 89 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
"homepage": "https://github.com/Rogerrrrrrrs/SwissQRBill#readme",
"devDependencies": {
"@types/iban": "0.0.30",
"@types/node": "^13.7.7",
"@types/node": "^13.9.2",
"@types/pdfkit": "^0.10.5",
"@types/qrcode": "^1.3.4",
"@types/qrcode-svg": "^1.1.0",
"@types/svg-parser": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"eslint": "^6.8.0",
"typescript": "^3.8.3"
},
Expand Down

0 comments on commit 51415b1

Please sign in to comment.