XML string incorrectly output by TCPDF/barcode/Datamatrix

142 Views Asked by At

i'm converting this piece of XML string into a 2D barcode using TCPDF/Datamatrix. This is my string:

<AN14>G6Y0A3</AN14>

This is how i'm trying to generate the barcode:

$pdf->write2DBarcode('<AN14>G6Y0A3</AN14>', 'DATAMATRIX', 124, 189, 66, 66, $some_defined_style, 'N');

PDF is generated correctly, however when i scan it, i get:

[)>06<AN14>G6Y7O2<D;GS9>A03

If i insert a whitespace in the middle of G6Y0A3 string resulting G6Y 0A3, i get a correct scan output.

I found out the issue is generated in this file: tcpdf/include/barcodes/datamatrix.php, specifically within this getHighLevelEncoding() function, however that's a way too low level programming for me.

Is this a bug? Am i doing something wrong? Maybe i'm missing to encode my xml string before sending it through write2DBarcode() function?

Thanks in advance.

1

There are 1 best solutions below

2
On

I came up with a similar problem. After reporting to Git TCPDF, I was denied access there. They have a bug in the code for generating datamatrix.