views:

1152

answers:

4

I am generating a barcode label and sending it to the user as a .pdf (this is a web app). The user has already purchased barcode labels that are only 2 inches wide. I want to use an image so that I don't have to install fonts on all of the users machines that will be using the web site. I am able to get the barcodes small enough if I use fonts from IDeautomation.com but I would much rather use an image generated using BarCodeRenderer or some other opensource project but I can not get the barcodes small enough as the system has pre-existing ID's of around 20 characters in length. What is the smallest Barcode font (I am trying to use 128 as the IDS are alphanumeric) and how can I resize the generated image in a way to make it fit in the width that I have available?(Other ideas or Libraries that do this are also accepted as answers)

A: 

I have had good luck using Data Matrix format as you can have varying amounts of data, and you can size the barcode as you wish.

Here are some links that may help:

libdmtx

Aspose.BarCode for .NET and Java

Barcode Writer in Pure PostScript

RedFilter
+1  A: 

What I've done is to take the barcode and make it fit the width that I want by resizing it down. What then happens is that the height is not good enough for most readers, so I copy the image and duplicated it above it, so it now is the width I want and double the height of the generator. That makes it more readable to most common off-the-shelf barcode readers.

jvanderh
DaveE
I tried this but in resizing the image it was no longer able to be read by the reader. Any code example of how you resized your images??
runxc1 Bret Ferrier
+1  A: 

If your barcodes only consist of an even number of numeric digits, you can quite easily switch to the Code C variant to get them down to half the size.

Generating a small barcode as an image in a PDF is going to be error prone, since you can't optimize to the dot size of the printer. Your barcode widths are going to be off by plus or minus half a dot; the wider your bars are, the less of an issue this will be. I've worked with label printers that are 203 DPI, and they would be nearly impossible to support with a generic image. Fonts are better since they can be hinted to be an exact multiple of dots. I don't know if any of the commercial barcode fonts have the necessary hinting, but I presume at least one of them does.

Mark Ransom
+2  A: 

IDautomation has several products.

Specifically they have one for Crystal reports with a Code 128 checksum calculator. It bypasses the need for a font and generates the font right in the report, which can go straight to PDF. The smallest size I have been able to use this feature is at about 12 point font. Specifically they have broken down the Code 128 font spec to allow you the smallest barcodes possible. This does not render as a font, or an image as far as I recall.

Alternatively I recall them having a product that will render a font as an image.

Another product that might be useful is Barbeque. Maybe you can find something along that line.

The other factors that weigh in when trying to print and read small barcodes are:

  • How long is the value that you are encoding in the barcode. 20 Characters is a lot.. Is there any way you can concatenate it, or shrink it somehow? Tricks I have used in the past include using a hashed value (or record number) that would link to all the values I needed. The shorter you can get your barcode, the smaller you can make it and still have it super clear.

  • Will the barcode get longer over time? If so, you might need a wider label, or consider a different format. I am starting to like a few of the 2D barcodes a lot.

  • Label material. I have seen issues with using colored or overly shiny labels instead of white, matte ones making it much harder to read.

  • The barcode readers can make a big difference. Having a laser based reader instead of an optical based one will give you greater resolution in reading barcodes. This means you can read them from further away, or read smaller ones. Symbol has some great $150 laser based barcode scanners.

The bar code printing and reading systems I've worked on have done in the range of a few million prints and reads with barcodes of small to medium sizes, so I hope some of the suffering and learning I've had above helps!

Jas Panesar