Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME PURCHASE SITEMAP COMPANY
BarcodeLib.com Home > Products > Barcode for Java > Barcode Planet


PLANET Barcode for Java, J2EE, JasperReports

This Symbology is also known as USPS PLANET Barcode, USPS Confirm Service Barcode

Quick Navigate
USPS Confirm service allows mailers to uniquely identify and track mail by placing an additional barcode, known as a PLANET Code, on the front of letter and flat mailpieces. The PLANET Code is a 12- or 14- digit barcode, a two-track barcode similar in structure to the POSTNET Code address barcode used by mail processing equipment to sort the mail.
PLANET Codes consist of a series of tall and short bars. PLANET Code digit Symbology is the inverse of POSTNET Code digit Symbology; each POSTNET Code digit uses a combination of two tall and three short bars; each PLANET Code digit uses three tall and two short bars. PLANET Codes must begin and end with one long "framing bar".
All PLANET Codes include a check-sum digit or correction character. This digit must always be the single-digit number (i.e., 0?) which, when added to the sum of the other digits in the barcode, results in a whole number that is a multiple of 10.
Depending on the type of Confirm mail, mailers must choose the appropriate PLANET Code format:
  • Destination Confirm to track outgoing mailings. PLANET Codes can be used to identify mail sent to customers
  • Origin Confirm to track incoming mail. PLANET Codes can be used to identify reply mail that customers send back
Destination Confirm PLANET Code Format
The Destination Confirm PLANET Code consists of the following elements:
  • Service Type ID: The first 2 digits represent the service (i.e., Destination Confirm) and the class/shape of the mail. Destination Confirm Service Type IDs are listed below
  • Subscriber ID: The next 5 digits identify the subscriber (assigned by the Postal Service)
  • Mailing ID: The next 4 or 6 digits are available to the mailer to use for their own identification purposes (e.g., mailings, clients, etc.)
  • Check-Sum Digit: The 12th or 14th digit is a check-sum digit that helps the Postal Service to detect errors
Mailers should use the PLANET Code in combination with the delivery point POSTNET Code to identify mailpieces uniquely.
Service Type IDs for Destination Confirm service:
  • 40 - First-Class Mail letters
  • 41 - First-Class Mail flats
  • 42 - Standard Mail letters
  • 43 - Standard Mail flats
  • 44 - Periodicals letters
  • 45 - Periodicals flats
  • 46 - First-Class Mail cards
  • 47 - Standard Mail cards
  • 22 - Residual Mail items
Origin Confirm PLANET Code Format
The Origin Confirm PLANET Code consists of the following elements:
  • Service Type ID: The first 2 digits represent the service (i.e., Origin Confirm) and the class/shape of the mail. Origin Confirm Service Type IDs are listed below
  • Customer ID: The next 9 or 11 digits are available to the subscriber to help identify the customer (i.e., mailer of reply mailpiece) or the reply mailpiece itself
  • Check-Sum Digit: The 12th or 14th digit is a check-sum digit that helps the Postal Service to detect errors
For Origin Confirm service, the Postal Service identifies the Confirm subscriber by the POSTNET Code preprinted on the reply mailpiece.
Service Type IDs for Origin Confirm service:
  • 50 - Courtesy reply letters
  • 51 - Courtesy reply flats
  • 52 - Business reply letters
  • 53 - Business reply flats
  • 54 - Business reply cards
  • 56 - QBRM letters
  • 57 - QBRM cards
  • 58 - Courtesy reply cards
  • 21 - Miscellaneous items
Planet Barcode for Java supports.
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

The following code illustrates how to create a barcode in a Java class

1            Linear linear = new Linear(); 
2            linear.setData("4012345235636"); 
3            linear.setType(Linear.PLANET); 
4            linear.renderBarcode("c:/barcode.gif"); 


  • Create a Linear object (line 1)
  • set Linear object properties (line 2 - 3)
  • save into gif file (line 4)

There are two ways to create barcode images in your Java web applications.

  1. This is the simplest way to stream barcode image using our provided barcode servlet classes.

    And it will not save barcode images in your server side.

    • Under demo package, copy barcode folder to your java servlet container like tomcat.

    • To test your installation, goto http://YourDomain:Port/barcode/linear?Data=4012345235636&Type=PLANET

    • To create barcode image in your JSP page, you can pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/linear?Data=4012345235636&Type=PLANET" />

  2. The second method is similar with the way to generate barcode in Java applications.

    • Create a barcode image in server side

      1            Linear linear = new Linear(); 
      2            linear.setData("4012345235636"); 
      3            linear.setType(Linear.PLANET); 
      4            linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/bimages/barcode.gif"); 
      
      
      

    • In your JSP page, you can using IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/bimages/barcode.gif" />

The following jasper xml content illustrates how to insert a barcode into JasperReports

<import value="com.barcodelib.barcode.BarcodeJasperFactory"/> 

Import class BarcodeJasperFactory to report.

<image scaleImage="Clip" hAlign="Center"> 
    <reportElement x="50" y="110" width="515" height="120"/> 
    <graphicElement/> 
    <imageExpression class="net.sf.jasperreports.engine.JRRenderable">
<![CDATA[new com.barcodelib.barcode.BarcodeJasperRenderer(BarcodeJasperFactory.createLinear(37, "4012345235636"))]]></imageExpression> </image>

Please go to class BarcodeJasperFactory in Java doc for all methods to create linear barcode.

Developers can also extend or modify BarcodeJasperFactory class to meet their own requirements. Complete BarcodeJasperFactory.java Source Code

Our Java barcode library supports generating barcode image in Eclipse BIRT framework.

Click here to view the details.

Just call Linear object method renderBarcode, e.g. linear.renderBarcode("c:/barcode.gif");
  • Set the type property to Linear.PLANET
    Servlet Parameter: "Type".
  • Set the data property with the value to encode. Type is String.
    Servlet Parameter: "Data".
  • Setting up barcode image size:
    • Set property uom (Unit of Measure) for properties barWidth, barHeight, 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 Parameter: "UOM".
    • Set the X (for barcode module width) and Y (for barcode module height) properties. Both types are float.
      Servlet Parameter: "X", "Y".
    • Set the leftMargin, rightMargin, topMargin and bottomMargin properties, and types are all float.
      Servlet Parameter: "LeftMargin", "RightMargin", "TopMargin", "BottomMargin".
    • Set the barcodeWidth (barcode image width) and barcodeHeight (barcode image height) properties. Both types are float.
      Servlet Parameter: "BarcodeWidth", "BarcodeHeight".
    • Set the resolution property (Value is expressed in DPI - Dots per inch).
      Servlet Parameter: "Resolution".
  • Setting up text style in barcode image:
    • Set the showText properties. If this value is true, barcode data will be displayed with the barcode.
      Servlet Parameter: "ShowText".
    • Set the textFont property. The font used to display text in barcode image.
      Servlet Parameter: "TextFont".
  • Set bearerBars property, if you want to draw borders around barcode image. Value can be Linear.BEARERBAR_UNSPECIFIED (-1. let library decide whether draw bear bars or not), Linear.BEARERBAR_NONE (0. no bear bars), Linear.BEARERBAR_FRAME (1. top, bottom, left, right borders drawn), Linear.BEARERBAR_TOPBOTTOM (2. only top, bottom's are drawn).
    Servlet Parameter: "BearerBars".
  • Set rotate property, if you want to rotate barcode image.
    Value can be
    0 (Linear.ANGLE_0),
    1 (Linear.ANGLE_90),
    2 (Linear.ANGLE_180),
    3 (Linear.ANGLE_270)
    Servlet Parameter: "Rotate".
  • addCheckSum property is not applied here. Barcode Library will automatically add one checksum character using Modulo 10.
    Servlet Parameter: "AddCheckSum".

To set barcode image width and height, there are two ways to do it.

1) You can set barcode image width and height through properties barcodeWidth and barcodeHeight values, barcode library will render the barcode image for you.

or

2) You can set X (barcode module width) and Y (barcode module height) values, barcode library will calculate the barcodeWidth and barcodeHeight values for you, and render the barcode image.

All Java Barcode Types/Symbologies


 







   Copyright 2009 BarcodeLib.com. Provides High Quality Java Barcode, Barcode Java, Java Barcode Generator. All rights reserved.