Add SVG support to datamatrix (#12875)

* Extract Data Matrix rendering helpers

* Add SVG Data Matrix output

* Verify vector Data Matrix output in PDFs

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
Petr Ledvina
2026-09-18 18:14:50 +10:00
committed by GitHub
co-authored by Oliver
parent 98f4a8203b
commit f76d79baf1
3 changed files with 335 additions and 35 deletions
+7 -2
View File
@@ -129,7 +129,12 @@ which produces the following output:
!!! info "ppf.datamatrix"
Data Matrix codes are generated using the [ppf.datamatrix](https://pypi.org/project/ppf-datamatrix/) library.
[Data Matrix Codes](https://en.wikipedia.org/wiki/Data_Matrix) provide an alternative to QR codes for encoding data in a two-dimensional matrix. To render a Data Matrix code, use the `datamatrix` template tag:
[Data Matrix Codes](https://en.wikipedia.org/wiki/Data_Matrix) provide an alternative to QR codes for encoding data in a two-dimensional matrix. To render a Data Matrix code, use the `datamatrix` template tag.
Data Matrix codes are rendered as PNG images by default. Use `fmt="SVG"` to
generate a vector image, avoiding intermediate raster scaling when a report
is resized or converted to printer output. Final module alignment still depends
on the printed dimensions and the printer's rasterization.
::: report.templatetags.barcode.datamatrix
options:
@@ -161,7 +166,7 @@ which produces the following output:
{% block content %}
<img class='qr' src='{% datamatrix "Foo Bar" back_color="yellow" %}'>
<img class='qr' src='{% datamatrix "Foo Bar" back_color="yellow" fmt="SVG" %}'>
{% endblock content %}
{% endraw %}