How to PDF Barcodes QR Codes

Barcodes and QR codes in PDFs enable scannable shipping labels, event tickets, product catalogs, and inventory documents. Embedding them directly in the PDF ensures they print at full resolution and scan reliably from paper. SublimePDF supports inline barcode and QR code generation through template helpers and SVG rendering, eliminating the need for external image services.

Follow the step-by-step instructions below, then use the free tool directly — no registration or download required.

Open Tool →

How to PDF Barcodes QR Codes — Step by Step

1

Add a QR code with the built-in helper

Use the SublimePDF template helper in your HTML: {{qrcode value='https://example.com/ticket/12345' size=150}}. This renders an inline SVG QR code at the specified size in pixels. The value can be any string — URLs, IDs, JSON payloads.

2

Generate barcodes in common formats

Use {{barcode value='123456789012' format='EAN13' height=80}} for standard barcode formats. Supported formats include Code128, Code39, EAN13, EAN8, UPC-A, ITF-14, and Codabar. Each format has specific character and length requirements.

3

Position codes in your layout

The barcode and QR code helpers output inline SVG elements. Wrap them in positioned <div> elements and use CSS for alignment: text-align: center, float: right, or absolute positioning within a relative container.

4

Add human-readable text below barcodes

Set displayValue=true in the barcode helper to render the encoded value as text below the barcode: {{barcode value='ABC-123' format='Code128' displayValue=true}}. Customize the text font size with fontSize=14.

5

Use dynamic data for unique codes

Combine barcode helpers with template variables: {{qrcode value=ticketUrl size=120}}. In a loop, each item generates its own unique code: {{#each products}}{{barcode value=this.sku format='Code128'}}{{/each}}.

Pro Tips

  • 💡 For shipping labels, use Code128 barcodes at a minimum height of 80px and add a 'quiet zone' (white padding) of at least 10px on each side to ensure reliable scanning.
  • 💡 QR codes should encode short strings when possible — URLs, IDs, or short JSON. Long payloads produce dense QR codes that may not scan reliably when printed on small labels.
  • 💡 Always test barcode and QR code scannability by printing the generated PDF at actual size and scanning with a physical reader or phone camera before production deployment.
  • 💡 SVG-based barcodes remain sharp at any print resolution, unlike raster images. This is why SublimePDF uses SVG rendering by default.

Privacy & Security

All processing happens directly in your browser. Your files are never uploaded to any server — they remain on your device throughout the entire process. SublimePDF uses WebAssembly technology for fast, secure, client-side processing.

Works Everywhere

This tool works on any modern browser — Chrome, Firefox, Safari, or Edge — on desktop, tablet, or mobile. No software to install. PDF is an open ISO standard supported by all major platforms.

How to PDF Barcodes QR Codes — FAQ

What barcode formats are supported?
Code128 (general purpose), Code39 (legacy industrial), EAN-13 and EAN-8 (retail products), UPC-A (North American retail), ITF-14 (shipping containers), Codabar (libraries and blood banks), and QR Code (2D, any data).
Can I customize the QR code's colors?
Yes. Pass foreground and background colors: {{qrcode value='data' size=150 foreground='#1a1a1a' background='#ffffff'}}. Ensure sufficient contrast between foreground and background for reliable scanning.
Will the barcodes scan when printed?
Yes. SublimePDF renders barcodes as crisp SVG vectors that print at the full resolution of your printer. Maintain the recommended minimum size for each barcode format and include quiet zones for best results.
Can I add a logo to the center of a QR code?
QR codes include built-in error correction that tolerates partial obstruction. Use the errorCorrection='H' parameter (30% tolerance) and overlay a small logo image with CSS absolute positioning over the center of the QR code SVG.

Ready to get started?

Use SublimePDF's free tools right now.

Open Tool