--- title: Barcode Generation --- ## Barcode Generation Both [report](./report.md) and [label](./labels.md) templates can render custom barcode data to in-line images. !!! info "img" Barcode data must be rendered inside an `` tag. Inside the template file (whether it be for printing a label or generating a custom report), the following code will need to be included at the top of the template file: ```html {% raw %} {% load barcode %} {% endraw %} ``` ### 1D Barcode !!! info "python-barcode" One dimensional barcodes (e.g. Code128) are generated using the [python-barcode](https://pypi.org/project/python-barcode/) library. To render a 1D barcode, use the `barcode` template tag, as shown in the example below: ```html {% raw %} {% load barcode %} {% endraw %} ``` The default barcode renderer will generate a barcode using [Code128](https://en.wikipedia.org/wiki/Code_128) rendering. However [other barcode formats](https://python-barcode.readthedocs.io/en/stable/supported-formats.html) are also supported: ```html {% raw %} {% load barcode %} {% endraw %} ``` ### QR-Code !!! info "qrcode" Two dimensional QR codes are generated using the [qrcode](https://pypi.org/project/qrcode/) library. To render a QR code, use the `qrcode` template tag: ```html {% raw %} {% load barcode %} {% endraw %} ``` Additional parameters can be passed to the `qrcode` function for rendering: ```html {% raw %} {% endraw %} ``` !!! tip "Documentation" Refer to the [qrcode library documentation](https://pypi.org/project/qrcode/) for more information