Royalty-free developer license, one time purchase for lifetime use
POSTNET Barcode Introduction
POSTNET is also known as USPS POSTNET Barcode, USPS POSTal Numeric Encoding Technique Barcode, Delivery Point Barcode (DPBC), Postnet 3 of 5.
The POSTNET (POSTal Numeric Encoding Technique) barcode was developed by the US Postal Service to encode ZIP Code information on letter mail for rapid and reliable sorting by BCSs. The POSTNET barcode can represent a five-digit ZIP Code (32 bars), a six-digit ZIP Code (37 bars), a nine-digit ZIP+4 code (52 bars), or an eleven-digit delivery point code (62 bars).
The Delivery Point Barcode (DPBC) is formed by adding 10 bars to an existing ZIP+4 barcode. The 10 bars represent two additional digits (normally the last two digits of the street address, post office box, rural route number, or highway contract route number).
The Delivery Point Barcode (DPBC) - USPS POSTNET
The POSTNET barcode is always printed in a format that begins and ends with a frame bar (full or tall bar). To ensure POSTNET accuracy during mail processing, a correction character a.k.a. Checksum (five bars) must be included immediately before the rightmost frame bar of all POSTNET barcodes.
POSTNET Encoding Data Scope
Postnet Barcode for Java supports:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
How to Generate POSTNET Barcode in Java Class?
The following Java code illustrates how to create a POSTNET barcode, and output to various formats.
1 Linear linear = new Linear(); 2 linear.setType(Linear.POSTNET); 3 linear.setData("202609900"); 4 linear.renderBarcode("c:/barcode.gif");
Under java_barcode_trial package, copy barcode folder to your java servlet container like tomcat.
Restart tomcat. Now you have installed successfully.
To test your installation, open your web browser and navigate to: http://YourDomain:Port/barcode/linear?Data=202609900&Type=POSTNET
To create barcode image in your JSP or html page, you need pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/linear?Data=202609900&Type=POSTNET" /> Using this method, it will not generate any barcode images in your server side.
The second method is to generate barcode images in your server side.
Create a barcode image in server side, like Linear linear = new Linear(); linear.setData("202609900"); linear.setType(Linear.POSTNET); linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/barcode-images/barcode.gif");
In your JSP or HTML page, you need use IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/barcode-images/barcode.gif" />
How to Generate Barcode POSTNET Image in Jasper Reports, iReport, Eclipse BIRT?
Set the type property to Linear.POSTNET Servlet URL Parameter: "Type". Value: 38. Sample: &Type=38.
Set the data property with the value to encode. Type is String. Servlet URL Parameter: Data.
Valid Data Scope:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Valid Data Format:The valid data length should be 5, 6, 9, 11 digits. And extra last digit is the checksum digit, do not include it in the Data property.
5 digit (plus check digit) - containing the basic ZIP Code only, referred to as the "A" code.
6 digit (plus check digit) - containing the last 2 digits of the ZIP Code and the 4 digits of the ZIP+4 Code, referred to as a "B" code.
9 digit (plus check digit) - containing the ZIP Code and ZIP+4 Code, referred to as the "C" code.
11 digit (plus check digit) - containing the ZIP Code, ZIP+4 Code, and the delivery point code. This is usually referred to as the DPBC, or Delivery Point Bar Code.
Sample: "12345678901".
addCheckSum property is not applied here. Barcode Library will automatically add one checksum character using Modulo 10.
Barcode image size settings.
Set property uom (Unit of Measure) for properties X, Y, leftMargin, rightMargin, topMargin and bottomMargin. Default is Linear.UOM_PIXEL (0). Valid values are Linear.UOM_PIXEL (0), Linear.UOM_CM (1), Linear.UOM_Inch (2). Servlet URL Parameter: "UOM". Value: 0 (pixel), 1 (cm), 2 (inch). Sample: &UOM=0.
Set the X (for barcode module width) and Y (for barcode module height) properties. Both types are float. Default X is 3. Y is 75. Servlet URL Parameter: "X", "Y". Sample: &X=3&Y=75.
Set the leftMargin, rightMargin, topMargin and bottomMargin properties, and types are all float. Default values are 0 for all 4 margin settings. Servlet URL Parameter: "LeftMargin", "RightMargin", "TopMargin", "BottomMargin". Sample: &LeftMargin=0.
Set the resolution property (Value is expressed in DPI - Dots per inch). Default is 72 dpi. Servlet URL Parameter: "Resolution". Sample: &Resolution=72.
Setting up text style in barcode image.
Set the showText properties. If this value is true, barcode data will be displayed with the barcode. Default is true. Servlet URL Parameter: "ShowText". Value: "t" (true), "f" (false). Sample: &ShowText=t.
Set the textFont property. The font used to display text in barcode image. Default is new Font("Arial", Font.PLAIN, 11). Servlet URL Parameter: "TextFont". Value format: [font name]|[font style]|[font size]. Sample Values: &TextFont=Arial|Bold|12
With rotate property, you can display barcode horizontally or vertically. Default value is 0. Servlet URL Parameter: "Rotate". Sample: &Rotate=0. Value can be: