New User? Sign Up  |  Sign In  |  Help
Barcode support and
tutorials from IDAutomation
and the community.
Click for the BBB Business Review of this Computers Hardware, Software & Services in Tampa FL
Resolved Questions Bookmark and Share

Encode GS, RS separators and EOT does not work in the Java Component.


We tried your suggestion:
You can encode your separators and EOT in the Java Component using:

~030 for RS
~029 for GS
~004 for EOT

You must also have ApplyTilde or ProcessTilde set to True.

We set the barcode.processTilde = true but it does not generate the field separators and EOT control characters.

Following is the test code;

public static byte[] getPDF417Barcode(String code, int rotate, int cols,
int ECLevel, boolean macroEnabled, int macroFileID,
boolean macroLastSeg, int macroSegIndex, int paddingLeft,
int paddingRight, int paddingTop, int paddingBottom) {

PDF417 barcode = new PDF417();
barcode.setDataToEncode(code);
double scale = 1;
int len = code.length();
int numCols = getNumCols(len);

if (cols > 0 && cols >= numCols) {
barcode.PDFColumns = cols;
} else { // determine the number of columns for user
barcode.PDFColumns = numCols;
}

barcode.rotate = rotate;
barcode.processTilde = true;


if (ECLevel != 0) { barcode.PDFECLevel = ECLevel; }
else { barcode.PDFECLevel = 3; }

barcode.MacroPDFEnable = macroEnabled;
barcode.MacroPDFFileID = macroFileID;
barcode.MacroPDFLastSegment = macroLastSeg;
barcode.MacroPDFSegmentIndex = macroSegIndex;
barcode.PDFMode = 1;

barcode.setSize(getPDF417PreferredSize(len, cols));

// create barcode image
BufferedImage img = new BufferedImage(barcode.getSize().width,
barcode.getSize().height,BufferedImage.TYPE_BYTE_INDEXED );

Graphics imgTempGraphics = img.createGraphics();
barcode.paint(imgTempGraphics);
barcode.invalidate();
imgTempGraphics.dispose();

// remove excess whitespace
img = trimWhiteSpace(img, paddingLeft, paddingRight, paddingTop,
paddingBottom);

// resize image if necessary
if (scale > 0) {
img = scaleImage(img, scale);
}

return getBinaryStream(img);
}

Test code as following:
package xxmc;
import com.idautomation.linear.BarCode;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
public class TestBarcode {
static InputStream inStream = null;
static BufferedImage img = null;
static byte[] blob = null;
static int paddingLeft = 5;
static int paddingRight = 5;
static int paddingTop = 5;
static int paddingBottom = 5;


public static void main(String[] args) {
StringBuilder tester = new StringBuilder();
for(int i=1; tester.length()<270; i++)
tester.append(i);
String data = tester.toString();
String data1= "~004TESTTHIS~029AGAIN~030ANOTHER";
try {


// test PDF417 barcode
blob = IDABarcode.getPDF417Barcode(data1, 0, 4, 3, false, 0,false, 0,
paddingLeft, paddingRight, paddingTop, paddingBottom);
inStream = new ByteArrayInputStream(blob);
img = ImageIO.read(inStream);
ImageIO.write(img, "jpg",
new File("T:appbarcodePDF417Testa.jpg"));

blob = IDABarcode.getPDF417Barcode(data, 0, 4, 3, false, 0,false, 0,
paddingLeft, paddingRight, paddingTop, paddingBottom);
inStream = new ByteArrayInputStream(blob);
img = ImageIO.read(inStream);
ImageIO.write(img, "jpg",
new File("T:appbarcodePDF417Testb.jpg"));


} catch (IOException e) {
System.out.println(e.getMessage());
}

}
}

======
We are using the IDAutomation Barcode Scanner ASCII Decoder for verifying the barcode.


03-21-12     3030 day(s) ago    

  Report Abuse

 

Ben

Best Answer

Your encoding mode is still set to 1, can you set it to 0.

bc.PDFMode=0;

Posted 3029 day(s) ago

(0)
(0)
  Report Abuse
 
Find Interesting
 
Email to Others
 
Bookmark
 
Subscribe to Answer Alert
No comments yet.     Be the first to comment.
Other Answers (15)
You are very welcome.

Posted 3025 day(s) ago

(0)
(0)
   Report Abuse
Hi Ben,

Thank you very much for your help. We can move on with our testing.



Posted 3025 day(s) ago

(0)
(0)
   Report Abuse
Although you do not see the RS, it will be encoded--the ASCII String Decoder will not display the character. I believe a certain setting must be modified in the scanner to decode it.

Posted 3025 day(s) ago

(0)
(0)
   Report Abuse
Hi,

I set the PDFMode=0 and ran the test again. The GS(29) and EOT(04) are showing on the PDF417, however the RS(30) did not show. See the attached image and code.

//*****************************************************************
//
// Copyright, IDAutomation.com, Inc. 2000-2004. All rights reserved.
//
// http://www.IDAutomation.com/
//
// NOTICE:
// You may incorporate our Source Code in your application
// only if you own a valid Java Barcode Package License
// from IDAutomation.com, Inc. and the copyright notices
// are not removed from the source code.
//
//
//*****************************************************************
import java.io.*;
import com.idautomation.pdf417.*;
import com.idautomation.pdf417.encoder.*;


class CreateJPEG

{
public static void main ( String [] args )
{

//Get the data to encode in barcode
String message = "~004" + "TESTTHIS" + "~029" + "AGAIN" + "~030" + "ANOTHER";
//BufferedReader in = new BufferedReader( new InputStreamReader( System.in ), 1 );
//System.out.print( "Enter data to encode: " );
String startString = "(";
String endString = ")";




PDF417 bc=new PDF417();

// set the data to encode
bc.code=message;
bc.PDFColumns=3;
bc.PDFECLevel=3;
bc.PDFMode=0;
bc.processTilde=true;




// create the file as the name of the message
barCodeEncoder bce;
bce = new barCodeEncoder(bc, "JPEG", "T:\app\barcode\BCtestPDF417A.jpeg");
System.exit(0);
}


}

image

Posted 3025 day(s) ago

(0)
(0)
   Report Abuse
We don't know the purchase date. Our client gave us the zip file and the order # is 42763.

Posted 3029 day(s) ago

(0)
(0)
   Report Abuse
What is your order number? When did you purchase the package/software?

Posted 3029 day(s) ago

(0)
(0)
   Report Abuse
image

Following is my test code.
//*****************************************************************
//
// Copyright, IDAutomation.com, Inc. 2000-2004. All rights reserved.
//
// http://www.IDAutomation.com/
//
// NOTICE:
// You may incorporate our Source Code in your application
// only if you own a valid Java Barcode Package License
// from IDAutomation.com, Inc. and the copyright notices
// are not removed from the source code.
//
//
//*****************************************************************
import java.io.*;
import com.idautomation.pdf417.*;
import com.idautomation.pdf417.encoder.*;


class CreateJPEG

{
public static void main ( String [] args )
{

//Get the data to encode in barcode
String message = "~004" + "TESTTHIS" + "~029" + "AGAIN" + "~030" + "ANOTHER";
//BufferedReader in = new BufferedReader( new InputStreamReader( System.in ), 1 );
//System.out.print( "Enter data to encode: " );
String startString = "(";
String endString = ")";




PDF417 bc=new PDF417();

// set the data to encode
bc.code=message;
bc.PDFColumns=3;
bc.PDFECLevel=3;
bc.PDFMode=1;
bc.processTilde=true;




// create the file as the name of the message
barCodeEncoder bce;
bce = new barCodeEncoder(bc, "JPEG", "T:\app\barcode\BCtestPDF417A.jpeg");
System.exit(0);
}


}


Posted 3029 day(s) ago

(0)
(0)
   Report Abuse
image

Following is my code for generating the PDF417 barcode image.
//*****************************************************************
//
// Copyright, IDAutomation.com, Inc. 2000-2004. All rights reserved.
//
// http://www.IDAutomation.com/
//
// NOTICE:
// You may incorporate our Source Code in your application
// only if you own a valid Java Barcode Package License
// from IDAutomation.com, Inc. and the copyright notices
// are not removed from the source code.
//
//
//*****************************************************************
import java.io.*;
import com.idautomation.pdf417.*;
import com.idautomation.pdf417.encoder.*;


class CreateJPEG

{
public static void main ( String [] args )
{

//Get the data to encode in barcode
String message = (char)4 + "TESTTHIS" + (char)29 + "AGAIN" +(char)30 + "ANOTHER";;
//BufferedReader in = new BufferedReader( new InputStreamReader( System.in ), 1 );
//System.out.print( "Enter data to encode: " );
String startString = "(";
String endString = ")";




PDF417 bc=new PDF417();

// set the data to encode
bc.code=message;
bc.PDFColumns=3;
bc.PDFECLevel=3;
bc.PDFMode=1;
bc.processTilde=true;




// create the file as the name of the message
barCodeEncoder bce;
bce = new barCodeEncoder(bc, "JPEG", "T:appbarcodeBCtestPDF417.jpeg");
System.exit(0);
}


}

Please help. Thanks.

Posted 3029 day(s) ago

(0)
(0)
   Report Abuse
I have attached a PDF417 barcode created with the Java Component. I encoded the TAB, GS, and EOT using ~009, ~029, and ~004. Please test scan this barcode.

Can you attach the barcode image that you have generated so that I can run a test scan on it?

When I scan my barcode sample into the ASCII String Decoder, the functions are decoded.

You may also use our Free ASCII String Decoder to display the separators and other functions:
https://www.idautomation.com/scanner-decoder/

NOTE:
Change the Encoding Mode from 1 to 0.




Posted 3029 day(s) ago

(0)
(0)
   Report Abuse
We tried and it does not work....

String data1= (char)4 + "TESTTHIS" + (char)29 + "AGAIN" +(char)30 + "ANOTHER";

Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
I believe you could encode it similar to this example:

String data1= (char)4 + "TESTTHIS" + (char)29 + "AGAIN" (char)30 + "ANOTHER";



Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
We were passing ACSII 004. Not so sure about (char)4. Would you please provide a sample code?
Thanks.

Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
Are you using char(04) or (char)4 ?

Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
We tried your recommendation earlier but it does not work using char(04), etc...

Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
You may also encode separator values for PDF417 using:

(char)29 for GS
(char)30 for RS
(char)4 for EOT

Posted 3030 day(s) ago

(0)
(0)
   Report Abuse
Email this question link to friends
You must enter an email address, if name is entered or vice-versa for each friend.
Friend #1 -
Friend #2 -
Friend #3 -
Friend #4 -
Friend #5 -
  Your comment on this question
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allows to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must starts with "http://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always starts with " http:// ")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 Characters are allowed. Current Count: 0
  Your comment on this answer
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allow you to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must start with "http://" or "https://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always start with "http://" or "https://")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 characters are allowed. Current Count: 0

You may answer and comment on any thread according to the Terms and Conditions.

 © Copyright 2019 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook