JavaPDF-417 Generator
|
PDF-417information: 1. A quiet zone: a mandated minimum amount of white space before the bar code begins. Note that all rows are the same width; each row has the same number of codewords. |
![]() |
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.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. |
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 |
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 |
|
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 Exceptionpublic 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