In this new post on the ThinkPHP blog, Jason Easter demonstrates how, with the help of the PDFlib library for PHP, you can create "press-ready PDF documents" whenever you need to (including barcodes).
Often people would like to create a PDF in offset quality out of a big bunch of addresses and create a barcode for each address. Sure, you could do this using the serial-letter-function in Word or any PHP library - the problem is that you have to stick to special standards, e. g. using CMYK colorspace and the like.
There may be other good solutions for that. Anyway, now let's talk about doing that by using PDFLib - in the lite (and therefor free) version.
His example uses the "lite" version of the library and JPGraph to create the barcodes. They create the barcode first (from a value passed in the $_GET string), then insert it into the PDF defined by the code they provide. They even show how to add additional text and an image to round out the look of the newly minted PDF.