Add barcode / QR code
add_barcodeCreate a PDF page embedding a barcode or QR code from text or URLs. Supports QR, Code 128, EAN-13, Data Matrix, and PDF417.
Instructions
Generate a single-page PDF embedding a barcode or QR code. Supported formats:
• qr — URLs, vCards, any UTF-8 text ≤ 4296 chars. Use ecLevel='H' for printed media (logos/dirt-tolerant); 'M' (default) for screens.
• code128 — alphanumeric SKUs, ASCII payloads.
• ean13 — retail product codes (must be 12 or 13 digits; 13th is auto-computed).
• datamatrix— dense industrial / aerospace markings.
• pdf417 — ID cards, boarding passes.
Common recipe for a QR code pointing to a URL: { format: 'qr', data: 'https://example.com', caption: 'Scan me' }. The data field is the raw payload — do NOT pre-encode URLs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | Barcode symbology to render. | |
| data | Yes | Raw payload to encode — do NOT URL-encode. For QR/URL pass e.g. "https://example.com" verbatim. EAN-13 must be 12 or 13 digits (13th is auto-computed). Code 128 accepts ASCII alphanumerics. | |
| caption | No | Optional caption rendered above the barcode. | |
| title | No | PDF document title (also rendered as page heading). | Barcode |
| width | No | Barcode width in PDF points. | |
| height | No | Barcode height in PDF points (ignored for square symbologies like QR/Data Matrix). | |
| ecLevel | No | QR ONLY. Error correction level (L=7%, M=15%, Q=25%, H=30%). Ignored for code128/ean13/datamatrix/pdf417. Use H for printed media that may get smudged or partially covered (e.g. logo overlay). | M |
| pdfA | No | Optional PDF/A conformance level (powered by pdfnative v1.2). Use 'pdfa1b' for archival of simple text+images, 'pdfa2b'/'pdfa2u' for richer content (2u guarantees Unicode mapping), 'pdfa3b' when embedding source attachments (Factur-X / ZUGFeRD). Mutually exclusive with PDF encryption. See docs/guides/PDFA.md. | |
| outputMode | No | base64 | |
| outputPath | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| sizeBytes | Yes | ||
| filePath | No | Absolute sandboxed file path (when mode='file'). | |
| base64 | No | Base64-encoded PDF bytes (when mode='base64'). |