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

  1. Add the PDF that needs barcoding.
  2. Enter the reference, order number or code to encode.
  3. Pick a corner and set the size — keep it wide enough for the bars to resolve, especially with longer data.
  4. Leave the pages field empty for the whole document, or name the pages you want.
  5. 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.

FAQ

Frequently Asked Questions

My barcode will not scan. What went wrong?
Almost always the bars are too thin, which happens when a long reference is drawn into a narrow space. The symbol gets wider with every character encoded, but the tool scales it to the width percentage you set, so more characters means finer bars. Raise the size slider, shorten the data, or both — and test with a real scanner at the size you will actually print.
Can I generate an EAN-13 or UPC barcode for retail products?
No. This tool produces CODE128 only. Retail symbologies have their own rules about length and check digits that CODE128 does not follow, so a product barcode intended for a shop till needs a different generator. CODE128 is the right choice for internal references, asset tags, job numbers and document tracking.
Why does it say it cannot encode my data?
CODE128 covers the standard ASCII character set. Accented letters, currency symbols outside that range, emoji and other extended characters cannot be represented, so rather than produce a symbol that scans as something unexpected, the tool refuses and tells you. Strip the data back to plain letters, digits and basic punctuation.
Can I put a different barcode on each page?
Not in one pass — a single encoded value is stamped onto every page in the range you choose. For per-page references, such as sequential job numbers, you would need to run the tool once per page, setting the data and the page number each time.
Are my order numbers or client references sent off to be encoded?
No. JsBarcode runs in this tab from a copy stored on this site, converting your text into a symbol on a canvas, and pdf-lib stamps the document in the same tab. A reference tying a document to a named customer or a specific sample is never transmitted, and there is no generator service keeping a log of what you encoded.
Is the human-readable number under the bars removable?
Not through the interface — the printed value is included by default, which is usually what you want, since it lets someone read the reference aloud or type it in when a scan fails. If a design absolutely requires bars alone, generating the symbol with the standalone barcode tool and placing it as an image gives you more control.