.NET Barcode for WinForms          ASP.NET Barcode          .NET Barcode Reader          Java Barcode          Java Barcode Reader
Home > Java Barcode > Java PDF-417 Generator

JavaPDF-417 Generator

Java PDF-417 Generation package to generate PDF-417 linear barcodes in Java applications.

  • Mature Java PDF-417 package consists of class library contains all necessary class files for java PDF-417 barcode generation.

  • Easy integration into your Java IDEs.

  • Compatible with Headless Java, under which images can be generated without a graphic environment in JDK 1.4 and above.

  • Java PDF-417 can be easily generated on any operating system with a JVM.

  • Orientation allows for changes among 0, 90, 180 or 270 degrees.

  • Easy encapsulation, integration and customization are supported with JavaBean obeying a particular convention under a developmental environment.

JavaPDF-417 Generator - Overview

Java PDF-417 generator is a mature and reliable Java barcode generation component for creating PDF-417barcodes in Java, Jasper Reports, iReport, and Eclipse BIRT projects. High-quality PDF-417 barcode images can be drawn and printed into GIF, BMP, PNG, JPEG/JPG & TIFF formats with Java PDF-417 barcode generator. Rich barcode options are provided to customize PDF-417 barcode properties in accordance with your needs.

PDF-417information:

PDF-417:one of 2 dimensional barcode symbologies, was developed by Dr. Ynjiun P. Wang at Symbol Technologies in 1991 and belongs to Motorola today. It is widely used in various applications, such as transport, identification cards, and inventory management.

Available encoding data:

numeric digits: 0-9

The structure of a PDF-417:

1. A quiet zone: a mandated minimum amount of white space before the bar code begins.
2. A start pattern: identifies the format as PDF417.
3. A "row left" codeword: containing information about the row (such as the row number and error correction level)
4. 1-30 data codewords: Codewords are a group of bars and spaces representing one or more numbers, letters, or other symbols.
5. A "row right" codeword with more information about the row.
6. A stop pattern.
7. A quiet zone.

Note that all rows are the same width; each row has the same number of codewords.


Java PDF-417 Generator Implementation to Generate PDF-417

1. Generate PDF-417 in Java class with the changing of barcode properties.

// Create Java PDF417 object
PDF417 barcode = new PDF417();

// Set PDF417 data text to encode
barcode.setData("PDF417-IN-JAVA");

// Generate PDF417 barcode & print into Graphics2D object
barcode.drawBarcode("Java Graphics2D object");

// Generate PDF417 barcode & encode into GIF format
barcode.drawBarcode("C://barcode-pdf417.gif");

// Generate PDF417 barcode & encode into JPEG format
barcode.drawBarcode("C://barcode-pdf417.jpg");


2. Generate & encode PDF-417 to EPS with changing the values concerned.

// Create Java PDF417 object
PDF417 barcode = new PDF417();

// Set PDF417 data text to encode
barcode.setData("Create PDF417 in EPS");

// Generate PDF417 barcode & encode into EPS
barcode.drawBarcode2EPS("C://barcode-pdf417.eps");

 

3. Generate & encode PDF-417 in html or jsp pages.

1. Under demo package, copy barcode folder and its contents to your tomcat.

2. Start tomcat, navigate to http://YourDomain:Port/barcode/barcode?DATA=PDF417EncodingData&TYPE=pdf417

3. To create bar code images in html or jsp pages, you can insert a image tag (img) into your page.

For example, <img src="http://YourDomain:Port/barcode/barcode?DATA=PDF417EncodingData&TYPE=pdf417" />

 

4. Two ways to set the width and height of generated barcode PDF-417 image.

1. Set the values of the barcodeWidth and barcodeHeight properties.
or
2. Set X (bar module width) and Y (bar module height) values

PDF-417 Property Settings in Java Barcode Generator

PDF-417 Basic Settings

Properties Value
Comments
Property URL Options Default
data DATA (Data to encode in the Codabar) ""

PDF-417 Valid Data Char Set:

Text Compaction mode permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.
Byte Compaction mode permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.
Numeric Compaction mode permits efficient encoding of numeric data strings.
Up to 811,800 different character sets or data interpretations.
Various function codewords for control purposes.


PDF-417 Special Settings

Properties Value
Comments
Property URL Options Default
dataMode
DATA-MODE
int

0

(DataMatrix.M_AUTO)

PDF417.M_AUTO (0)
PDF417.M_TEXT (1)
PDF417.M_BYTE (2)
PDF417.M_NUMERIC (3)
processTilde

PROCESS-TILDE
true or false
true

Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.

1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
Strings from "~256" to "~299" are unused
2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
Strings from "~665536" to "~699999" are unused
Programming for reader initialisation: ~rp.
This should be located at the beginning of the encoding data, e.g. data = "~rpABCD1234".
ECI: ~7dddddd (valid value of dddddd from 000000 to 999999) .

ECL
ECL
int
2(PDF417.ECL-2)

Error correction level, values are from PDF417.ECL_0 to PDF417.ECL_8.

rowCount
ROW-COUNT
int
3 The number of rows for PDF417. The value range is from 3 to 90. The default is 3. .
columnCount
COLUMN-CONUT
int
5 Number of columns. The value range is from 1 to 30. The default is 5. Increase this value, if your data size is large
isMacro
MACRO
boolean
false Set isMacro property to true, then Macro PDF417 is enabled.
macroSegmentCount
MACRO-SEGMENT-COUNT
int
0 the number of total symbols which make the sequence.
macroFileIndex
MACRO-FILE-INDEX
int
0 This property is to be identified to the same file.
macroSegmentIndex
MACRO-SEGMENT-INDEX
int
0 the position of current symbol in the secuence (Start with 0).

PDF-417 Text Settings

Properties Value
Comments
Property URL Options Default
showText

SHOW-TEXT
true or false
true


Show text underneath the barcode

textColor

TEXT-COLOR
Color
black

Color of the shown text

textFont
TEXT-FONT
Font
New font("Arial",Font.PLAIN,11)

The font, font style and font size of the text

textMargin
TEXT-MARGIN
float
6

The space between the text and the barcode symbol

PDF-417 Size Settings

Properties Value
Comments
Property URL Options Default
rotate

Rotate
Degree0, 90, 180, 270
0 (Barcode.Rotate_0)

Rotate the Angle of the Codabar images

autoResize

AUTO-RESIZE
true or false
false

Auto resize the generated barcode image

barcodeHeight
BARCODE-HEIGHT
float
0

Barcode image Height

barcodeWidth
BARCODE-WIDTH
float
0

Barcode image Width

bottomMargin
BOTTOM-MARGIN
float
0

Barcode image bottom margin size
leftMargin LEFT-MARGINE float 0


Barcode image left margin size

rightMargin RIGHT-MARGIN float 0

Barcode image right margin size.

topMargin TOP-MARGIN float 0


Barcode image Top margin size
barAlignment BARALIGMENT int 1(center)


Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right.
uom
UOM
Pixel, Cm, or Inch
0(Pixel)

Unit of Measure for all numeric properties.Valid values: 0: pixel; 1: inch; 2: cm.
X X float 1

Width of barcode bar module (narrow bar), default is 1 pixel

Y Y float 30

Height of barcode bar module, default is 30 pixel

PDF-417 Color Settings

Properties Value
Comments
Property URL Options Default
backColor
BACK
-COLOR
Color
white

Barcode image background color

foreColor
FORE
-COLOR
Color
black
Barcode image foreground color

PDF-417 Image Settings

Properties Value
Comments
Property URL Options Default
resolution
RESOLUTION
int
72

Resolution of Codabar Image, Dots Per Inch

Method

// generate barcode and output to OutputStream object
public boolean drawBarcode(OutputStream outputStream) throws Exception

// generate barcode into a new BufferedImage object
public BufferedImage drawBarcode() throws Exception

/*
Use this method to generate barcode, and save into gif or jpeg files
1. to save into gif file, filename ends with ".gif", like "c:\\barcode.gif"
2. to save into jpeg file, filename ends with ".jpg", like "c:\\barcode.jpg"
*/

public byte[] drawBarcodeToBytes() throws Exception

public boolean drawBarcode(String imageFile) throws Exception

// Generate barcode and save into EPS file, the filename must ends with ".eps"
public void drawBarcode2EPS(String filename) throws Exception

// Generate barcode on Graphics2D object within certain area
public void drawBarcode(Graphics2D g, Rectangle2D rectangle) throws Exception