Tuesday, June 24, 2014

Acrobat -- Create an Intelligent Mail Barcode Field

Direct purchase using PayPal ($50 only per license)!

The United States Postal Service (USPS) developed a type of barcode it uses to easily identify addresses in the US, called Intelligent Mail Barcode (or IMB). This barcode symbology is composed out of 65 vertical bars, based on a set of 31 (or possibly less) digits, which represent the Barcode identifier, Service type identifier, Mailer ID, Sequence number and finally the Delivery point ZIP code.

This barcode format is very useful when printing shipping labels for addresses in the US and using it can help make sure your letters arrive to their correct destination on time.

So how can we integrate this technology into our PDF files? The USPS provides a free font that can be installed on your computer and subsequently used as the font of a text field in a PDF, and using this tool I've developed it's never been easier to set it up!

Let's say we have a field that contains the IMB value, and another field where we want the barcode to appear:

The original file with the two fields, and the menu item added by the script on the right (click to enlarge)
After the script is installed on the computer it adds a new menu button under the Tools panel, which allows us to set up our IMB field (the lower one in this case). Pressing the button pops-up this dialog:

The script's settings dialog window

In this dialog we select the Value and the Barcode field names, as well as the type of value we use.
In this case we have an non-encoded numeric value, so we select the first option. If we have an encoded value with A/D/F/T letters (for example: "FADDFAFTFTADAFDTFDDAAFDFAFADFTTDTFDDTDTTDDTTFFATFDFAATFAFAFTDFFDD"), we would select the second option.
Next we select whether the Mailer ID has 6 or 9 digits, and finally whether to hide the value field (in this case we keep it visible).
We click OK to proceed and get this message:

Clicking on Yes is recommended as it's required that the Barcode field use this font for the IMB barcode to appear.

And the result is this:
The original value and the corresponding barcode (click to enlarge)

If we change the text in the Value field to a different (valid) number, the Barcode field will update immediately as well:

Value field edited: Last digit changed to "3" (click to enlarge)
All the required code is now embedded in the PDF file and there's no need to use any external resources, as the font is fully embedded as well.

The fonts can be downloaded from here: https://ribbs.usps.gov/onecodesolution/download.cfm
(for a Windows computer I recommend looking for the latest version of the USPS non-AFP Fonts and then installing the TrueType font called "USPSIMBStandard.ttf" inside the zip file).

To verify the barcodes generated by the script one can use this online encoder tool by the USPS:

If you have any questions regarding this tool, contact me directly.

No comments: