Our Customers
Contact Us Email: support@barcodelib.com
Home > Java Barcode Generator > Java Barcode Generation Guide > Java PLANET Barcode Generator
Download Barcode for Java Trial

Java PLANET Barcodes Generator Guide

PLANET Bar Code Generation Guide in Java class, J2EE, Jasper Reports, iReport & Eclipse BIRT
  • Easily generate PLANET barcodes in Java applications
  • Generate high quality PLANET images in JPEG, GIF & PNG formats
  • 100% build in Java, compatible with JDK 1.4 and later version
  • Generate PLANET barcodes on any applications and platforms with Java virtual machine installed
  • Generate PLANET in Jasper Reports & iReport
  • Generate PLANET in Eclipse BIRT
  • Professional Java Barcode Generator library which enjoys customer appreciation for more than 10 years
  • Royalty-free developer license, one time purchase for lifetime use
PLANET Barcode Introduction
PLANET is also known as USPS PLANET Barcode, USPS Confirm Service Barcode.
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 Encoding Data Scope
Planet Barcode for Java supports:
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
How to Generate PLANET Barcode in Java Class?
The following Java code illustrates how to create a PLANET barcode, and output to various formats.
1     Linear linear = new Linear(); 
2 linear.setType(Linear.PLANET);
3 linear.setData("4012345235636");
4 linear.renderBarcode("c:/barcode.gif");

5 BufferedImage bufferedImage = linear.renderBarcode();

6 byte[] barcodeBytes = linear.renderBarcodeToBytes();

7 Graphics2D g = ...
8 Rectangle2D rectangle = ...
9 linear.renderBarcode(g, rectangle);

10 OutputStream outputStream = ...
11 linear.renderBarcode(outputStream);
  • Create a Linear barcode object (line 1)
  • Set Linear object barcode type to PLANET (line 2)
  • Set PLANET barcode data to encode (line 3)
  • Encode generated PLANET barcode into gif image file (line 4)
  • Generate PLANET and output to BufferedImage object (line 5)
  • Generate PLANET in bitmap and output to byte[] (line 6)
  • Generate PLANET and draw to defined area (Rectangle2D) on Graphics2D (line 7-9)
  • Generate PLANET and output to OutputStream (line 10-11)
How to Generate PLANET Barcode Image in Java Web Applications?
There are two methods to create PLANET barcode images in your Java web applications.
  1. The simplest way is to stream barcode image using our buildin barcode servlet application.
    • Download the Barcode for Java Trial Package, and unzip it.
    • 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:

    • 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=4012345235636&Type=PLANET" />
      Using this method, it will not generate any barcode images in your server side.
  2. 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.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 PLANET Image in Jasper Reports, iReport, Eclipse BIRT?
PLANET Barcode Property Settings
  1. Set the type property to Linear.PLANET
    Servlet URL Parameter: "Type". Value: 37. Sample: &Type=37.
  2. 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 11 or 13. And extra last digit is the checksum digit, do not include it in the Data property.
    • Sample: "1234567890123".
  3. addCheckSum property is not applied here. Barcode Library will automatically add one checksum character using Modulo 10.
  4. 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.
  5. 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
  6. With rotate property, you can display barcode horizontally or vertically.
    Default value is 0.
    Servlet URL Parameter: "Rotate". Sample: &Rotate=0.
    Value can be:
    • 0 (Linear.ANGLE_0),
    • 1 (Linear.ANGLE_90),
    • 2 (Linear.ANGLE_180),
    • 3 (Linear.ANGLE_270).
How to Set Generated PLANET Barcode Image Size?

All Java Barcode Types/Symbologies

Encode Linear Barcodes:
Encode Matrix Barcodes: