By Date: <-- -->
By Thread: <-- -->

Barcode PDF417 with data in byte form



Hi,

While generating PDF417-Barcodes out of data in byte format (using
the method setText(byte[])), we encountered a problem: Everything
went well if the data size was smaller than 900 bytes.
For data bigger than 900 bytes there occurred sometimes the
following error:


java.lang.IndexOutOfBoundsException: The text is too big. at com.lowagie.text.pdf.BarcodePDF417.textCompaction(Unknown Source) at com.lowagie.text.pdf.BarcodePDF417.assemble(Unknown Source) at com.lowagie.text.pdf.BarcodePDF417.paintCode(Unknown Source) at com.lowagie.text.pdf.BarcodePDF417.getImage(Unknown Source) at pdf417.PDF417iText.main(PDF417iText.java:77)


The interesting point about this problem was, that it occurred not regularly, and that there were examples with 925 or more bytes which worked fine, while others with less data (917 bytes) showed the above error. The problem seemed absolutely non-deterministic.

Analysis of the source code showed that the source of the problem
consisted in the method breakString() in the class PDF417.java. As
we are working with zipped data,
it makes no sense at all to segmentize data in text and byte
segments - when every byte with a value < 127 is treated as text
while the bytes > 127 form byte segments,
we find ourselves with 50 to 60 segments and we loose the 50 to 60
codewords used in the barcode to indicate the switch between text
and byte mode.

As it is not possible to avoid the method breakString() we had to
modify the source code and are now working with a simplified method
of breakString():


void breakStringTst() { int i = text.length; segmentList.add('B', 0, i); }


With this method, we are able to generate barcodes up to 1100 bytes.

Would it be possible to add a flag 'forceBytes' to the code,
permitting to omit the segmentation in the method breakString() or
is it necessary to force its execution?
As we already have a solution to our problem, we could offer a
patch, adding an option 'forceBytes' to the option set which would
avoid the segmentation of byte data.

Best Regards

Isabelle Flückiger

_________________________________________________________________
Holen Sie sich brandaktuelle CD-Neuerscheinungen völlig legal auf Ihren PC! http://sib1.od2.com/common/framework.aspx?shid=00450045




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions