Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
## [2.8.4] - Not released yet
### Added
* documentation on [internal linking with variable page numbers](https://py-pdf.github.io/fpdf2/Links.html#internal-links)
* documentation on [generating rMQR Codes](https://py-pdf.github.io/fpdf2/Barcodes.html#rmqr-code)
### Fixed
* an `IndexError` was raised in some cases when rendering HTML with nested lists - _cf._ [issue #1358](https://github.com/py-pdf/fpdf2/issues/1358)
* an `IndexError` was raised in some cases when using [text_columns()](https://py-pdf.github.io/fpdf2/TextColumns.html) with [text shaping enabled](https://py-pdf.github.io/fpdf2/TextShaping.html) - _cf._ [issue #1439](https://github.com/py-pdf/fpdf2/issues/1439)
Expand Down
21 changes: 13 additions & 8 deletions docs/Barcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,24 @@ Here is an example on how to generate a [QR Code](https://en.wikipedia.org/wiki/
using the [`python-qrcode`](https://github.com/lincolnloop/python-qrcode) lib:

```python
from fpdf import FPDF
import qrcode
{% include "../tutorial/qrcode_demo.py" %}
```

pdf = FPDF()
pdf.add_page()
img = qrcode.make("fpdf2")
pdf.image(img.get_image(), x=50, y=50)
pdf.output("qrcode.pdf")
Output preview:

![QCode embedded with fpdf2](qrcode.png)


## rMQR Code ##
rMQR Codes, aka Rectangular Micro QR Codes, can be inserted in PDF documents using `fpdf2` and the [`rmqrcode`](https://github.com/OUDON/rmqrcode-python) library:

```python
{% include "../tutorial/rmqrcode_demo.py" %}
```

Output preview:

![](qrcode.png)
![rMQR code embedded with fpdf2](rmqrcode.png)


## DataMatrix ##
Expand Down
Binary file added docs/rmqrcode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions tutorial/qrcode_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from fpdf import FPDF
import qrcode

pdf = FPDF()
pdf.add_page()
img = qrcode.make("fpdf2")
pdf.image(img.get_image(), x=50, y=50)
pdf.output("qrcode.pdf")
10 changes: 10 additions & 0 deletions tutorial/rmqrcode_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from fpdf import FPDF
from rmqrcode import QRImage, rMQR

qr = rMQR.fit("https://py-pdf.github.io/fpdf2/")
qrimg = QRImage(qr, module_size=1)

pdf = FPDF()
pdf.add_page()
pdf.image(qrimg._img, w=100, x="CENTER")
pdf.output("rmqrcode.pdf")