IndexOutOfBounds when encoding a PDF417
See original GitHub issueI’m trying to encode a PDF417 and whenever I set the PDF417_COMPACTION
to Compaction.TEXT
I get this crash:
java.lang.ArrayIndexOutOfBoundsException: length=128; index=8226
at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.isMixed(PDF417HighLevelEncoder.java:456)
at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.encodeText(PDF417HighLevelEncoder.java:298)
at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.encodeHighLevel(PDF417HighLevelEncoder.java:185)
at com.google.zxing.pdf417.encoder.PDF417.generateBarcodeLogic(PDF417.java:649)
at com.google.zxing.pdf417.PDF417Writer.bitMatrixFromEncoder(PDF417Writer.java:107)
at com.google.zxing.pdf417.PDF417Writer.encode(PDF417Writer.java:87)
at com.google.zxing.MultiFormatWriter.encode(MultiFormatWriter.java:102)
Here is the code for how I am trying to create the barcode:
var hints: MutableMap<EncodeHintType, Any>?
hints = EnumMap<EncodeHintType, Any>(EncodeHintType::class.java)
hints[EncodeHintType.CHARACTER_SET] = "UTF-8"
hints[EncodeHintType.ERROR_CORRECTION] = 6
hints[EncodeHintType.PDF417_COMPACTION] = Compaction.TEXT
val writer = MultiFormatWriter()
val result: BitMatrix
try {
result = writer.encode(contents, format, img_width, img_height, hints)
} catch (iae: WriterException) {
// Unsupported format
return null
}
Is this a bug or am i doing something wrong?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
IndexOutOfBounds when encoding a PDF417 - Stack Overflow
I'm trying to encode a PDF417 and ...
Read more >Developers - IndexOutOfBounds when encoding a PDF417 -
I'm trying to encode a PDF417 and whenever I set the PDF417_COMPACTION to Compaction.TEXT I get this crash: java.lang.ArrayIndexOutOfBoundsException: ...
Read more >PDF417 2D Barcode Information & Tutorial - BarcodeFAQ.com
The PDF417 barcode is a two-dimensional (2D), high-density symbology capable of encoding text, numbers, files and actual data bytes.
Read more >Java barcode generator / Bugs - Barbecue - SourceForge
#. Sort A ‑> Z; Sort Z ‑> A Summary▾. Sort A ‑> Z; Sort Z ‑> A Milestone▾. Sort A ‑> Z;...
Read more >OkapiBarcode Open-source barcode encoding prog @codeKK ...
Introduction: Open-source barcode encoding program written in Java ... avoid ArrayIndexOutOfBoundsException in some rare corner cases; PDF417: add ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i use java ,i work for android
I suspect it’s a bug, and I unfortunately have no idea what. I think there are a few latent bugs in the PDF417 parts. If you figure it out, feel free to open a PR. What language is this BTW?