Add a CODE128 Barcode to PDF Pages
Encodes your reference as a CODE128 barcode with JsBarcode and stamps it onto the pages you choose with pdf-lib — for invoices, works orders, hire agreements and anything else that needs to be scanned into a system.
About the PDF Barcode Inserter
Type the data to encode, choose a corner, set the size and pick which pages get the barcode. The code is generated as CODE128 with 90-pixel-tall bars, a white background and the human-readable value printed underneath, then embedded and drawn onto each target page with a 24-point inset. Leaving the pages field empty stamps the entire document.
The size slider defaults to 24 percent of the page width — noticeably larger than the QR default, and deliberately so. A barcode is a wide, short shape, and it needs horizontal room for the scanner to resolve the individual bars, so being generous with the width is what makes the difference between a code that reads first time and one that does not.
Key Features
- CODE128 encoding: A variable-length symbology covering the full ASCII range, so references mixing letters, digits and punctuation encode fine — unlike retail formats that accept digits only and demand a fixed length.
- Human-readable value included: The data is printed as text beneath the bars, so anyone can key it in manually when a scanner is not to hand or the print is damaged.
- Stamps a range or the whole document: Individual page numbers and ranges can be combined, so a barcode can go on every page of a works order or only on the pages that get filed.
- Four corner placements: Bottom right, bottom left, top right and top left, inset 24 points from the page edges.
- Opaque white background: The barcode carries its own white field rather than sitting transparently over the page, which preserves the quiet zone scanners need to find the code.
- Nothing leaves the building: JsBarcode generates the symbol and pdf-lib writes the document, both from libraries stored on this domain, so order numbers and client references are not transmitted to encode them.
How to Use the PDF Barcode Inserter
- Add the PDF that needs barcoding.
- Enter the reference, order number or code to encode.
- Pick a corner and set the size — keep it wide enough for the bars to resolve, especially with longer data.
- Leave the pages field empty for the whole document, or name the pages you want.
- Press Insert Barcode and download the result, saved with -barcode appended.
How It Works
The barcode is rendered by JsBarcode onto a canvas and embedded as a PNG. Because the width is set as a percentage of the page, and because a CODE128 symbol gets physically wider the more characters you encode, there is a trade-off you need to be aware of: a long reference squeezed into a narrow placement produces thin bars, and thin bars are what scanners fail on.
The practical rule is to keep the encoded data short and the placement wide. A ten-character reference at 24 percent scans reliably; a thirty-character one at the same setting may not, and the fix is either a shorter reference or a larger size setting.
Only CODE128 is supported here. If you need EAN-13 for retail, UPC-A for North American products, or Code 39 for older systems, this tool will not produce them, and it will refuse data it cannot encode rather than generating something unscannable — characters outside the standard ASCII range will produce an error instead of a broken symbol.
When You Need It
An equipment hire company puts an asset reference on every page of its hire agreements so that returns can be booked in by scanning whichever sheet comes back with the machine. The agreements carry customer account details and hire rates, so a document that gets barcoded on the office machine rather than through a web service is both faster and one fewer place where customer data sits.
A laboratory barcodes sample submission forms with the batch reference before they go out to collection sites. Keying batch numbers by hand is where transcription errors enter the chain, and scanning removes that step. Because the forms are linked to identifiable samples, processing them locally keeps a chain of custody that does not have an unexplained hop through someone else's server in the middle of it.