pgzint
pgzint · Generate PNG barcodes and QR codes inside PostgreSQL with the Zint library
Overview
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
pgzint generates barcode images inside PostgreSQL with the Zint library and returns PNG bytes as bytea. Use it when an application can consume binary images but should not integrate Zint directly.
Core Workflow
Install the extension, inspect the symbol catalog, and call either a convenience wrapper or the general generator:
bc_generate accepts the payload, Zint symbology ID, height, scale, whitespace and border widths, output flags, colors, text flag, three symbology-specific options, and rotation. In 0.2.0 the height argument is float8.
Important Objects
bc_generateis the C-backed general generator.bc_qrcode,bc_excode39,bc_pdf417,bc_maxicode, andbc_code128are SQL wrappers with project-selected defaults.bc_symbolsmaps Zint numeric IDs to constants and display names.getzintsymbolid(text)andgetzintsymbolconstant(integer)convert between those identifiers.pgzint_version()reports the installed pgzint version.
Version 0.2.0 removes the old barcodes view and simplifies bc_symbols; integrations must use the three columns shown above rather than the metadata columns removed by this release.
Upgrade and Requirements
After installing the 0.2.0 package files, upgrade each database that already has pgzint:
pgzint 0.2.0 requires PostgreSQL 9.4 or newer and Zint 2.14 or newer compiled with PNG support. It uses Zint’s in-memory PNG output instead of the earlier BMP-to-PNG conversion and no longer has a direct libpng conversion layer.
Image generation consumes database CPU and can return large binary values. Bound payload sizes, avoid unreviewed bulk generation in latency-sensitive queries, and validate output against the scanners and barcode standards required by the application.