Decoding USPS PDF417 2D Barcode?

4.9k views Asked by At

I have Googled a lot and failed to find the decoding algorithm for the PDF417 barcode used by United States Postal Service. I want to fetch recipient and sender information with tracking number out of it.

I have successfully decoded the FedEx barcode with ANSI MH10.8.3 standard.

Here is an example barcode that I want to decode

My question is, am I scanning the correct barcode (I am not from USA, so I don't know which barcode label USPS applies to their parcels) ? If no, then what barcode should I look for to fetch required information ? If Yes, then how can I decode this barcode ?

Please help, Thanks.

Edit:

Here is another similar barcode

enter image description here

1

There are 1 answers

4
Paul Guyot On BEST ANSWER

You should check this webpage:

https://en.wikibooks.org/wiki/International_Postage_Meter_Stamp_Catalog/United_States_of_America,_Part_3

As well as this page: http://www.stamps.com/postage-online/how-it-works/

Your first barcode seems to have been generated by Endicia software (ID# starts with 071V), while the second example barcode was generated by stamps.com (as printed, and also ID# starts with 062S).

It seems that stamps.com service allows you to print stamps without providing the recipient address. For this reason, the barcode probably doesn't include any information about the recipient.

For the record, the decoded bars are as follows:

0000  50 01 dc 78 0c 00 30 37  31 56 57 6c 08 00 7a 86  | P~~x~~071VWl~~z~ |
0010  09 c5 4e d8 27 00 8a b7  32 01 24 4f 00 00 67 49  | ~~N~'~~~2~$O~~gI |
0020  6d 15 00 b5 c3 00 00 00  00 06 c1 31 02 b9 02 90  | m~~~~~~~~~~1~~~~ |
0030  d0 a4 4a 1c 02 2a 42 8f  a7 3f 6d c7 03 ea e5 d7  | ~~J~~*B~~?m~~~~~ |
0040  3c 69 86 3c 50 29 28 32  11 74 6a 7f b4 af c7 90  | <i~<P)(2~tj~~~~~ |
0050  16 c3 90 bb fb 2a fa 4e  78 95 e6 20 69 c7 75 01  | ~~~~~*~Nx~~ i~u~ |
0060  00 00                                             | ~~               |

and:

0000  05 01 ff ff 00 00 30 36  32 53 3b 47 70 00 f2 ed  | ~~~~~~062S;Gp~~~ |
0010  10 00 00 14 1e 00 56 52  33 01 59 33 01 00 00 00  | ~~~~~~VR3~Y3~~~~ |
0020  00 00 00 00 04 00 02 00  00 5c da 00 00 38 30 33  | ~~~~~~~~~\~~~803 |
0030  34 ae 69 57 0d 59 42 1c  d4 0b 00 f2 d3 7f 4f f8  | 4~iW~YB~~~~~~~O~ |
0040  ef 69 53 a0 aa fb 9b cf  30 16 13 c3 08 3e 86 4a  | ~iS~~~~~0~~~~>~J |
0050  7a e8 4c fe 1f eb 4d 2c  52 05 00 6f 33 01 00     | z~L~~~M,R~~o3~~  |
  • Bytes 06-09 (0-indexed) is the ID prefix in ASCII.
  • Bytes 0A-0D is the rest of the ID, encoded in binary in little endian. 3B 47 70 00 is 0x0070473B = 7358267, for the second stamp.

  • For the second stamp, bytes 5B-5D (6F 33 01) is actually 01 33 6F = 78703, the zip it was posted from. Unfortunately, it doesn't work with the first stamp.