Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

How do barcodes appear inside a PDF file

59 sec read

A barcode is a set of lines which contain machine-readable data – run a barcode reader over them and you can access some interesting information (so it is a bit like a sort of braille for machines). As barcodes are very useful and PDF files are very common, it is not surprising that we see quite a few barcodes in PDF files. The interesting thing is that there is no standard way to put a barcode inside a PDF. So here are the different ways we have seen…

Bar code as an image

This is the most common way to do it. The barcode is turned into a single bit-map or vector image and embedded in the PDF.

Barcode as text

A special font is used to show the barcode and a text string is drawn in the PDF file, using the barcode font.

Barcode as a form object

The barcode is added as an annotion which may be text or an image.

Barcode as embbed images

The barcode is added as a set of embedded lines (black or white). When all drawn, the images produce the full barcode.

So while the barcodes may look identical, different PDF creation tools add the barcode in very different ways and will give very different results if you try to extract them.

Do you have any other examples to add to my list?

This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

Did you know...

IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?

It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Enabling SVG Gzip Compression on Apache and NGINX

Gzip compression is a widely supported method of reducing the size of the content sent from a web server in order to improve the...
Leon Atherton
47 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2020. All rights reserved.