Open vekocarlo opened 2 years ago
Thank you for reporting this here, what was the other site ? Can you link it here ?
The original link: https://sourceforge.net/p/tcpdf/bugs/1133/
The original link: https://sourceforge.net/p/tcpdf/bugs/1133/
Thanks, oh no I did not know about this projet having a sourceforge page .. A hole new set of bugs hidden 😿
Ok, im not sure why but I tried some modifications based on the sourceforge comments and got it working(at least for the example). The only change done was:
if (($field_length == 4) OR ($epos == $data_length) OR !$this->isCharMode($chr, ENC_EDF)) {
to
if (($field_length == 2) OR ($epos == $data_length) OR !$this->isCharMode($chr, ENC_EDF)) {
I know nothing about datamatrix but maybe could you provide proof this change is the right one ?
because this was added 9 years ago (!) in https://github.com/tecnickcom/TCPDF/commit/e691de8a1e4d25473c9f9206f036a3d933901e6a#diff-1e3444e4ddd5c4e54598f566a66f880f3e9a7184a35b6e40fe4a79da568dd0a0R862 (expand include/barcodes/datamatrix.php
)
-if (($field_length == 4) OR ($epos == $data_length) OR !$this->isCharMode($chr, ENC_EDF)) {
+if (($field_length == 2) OR ($epos == $data_length) OR !$this->isCharMode($chr, ENC_EDF)) {
Above are the same qr code: $pdf->write2DBarcode("@06@12S0002@PA9D8000000000@1P70431188AB@31P04311880AB@12V12345678@10VABC-DEFGHIJ@2PAB@20P@6D20170505@14D20180121@30P@ZN@K0042035913@16K293679", 'DATAMATRIX', 16, 16, 125,125, array(), 'N');
One is before and the other after the adjustment. I cannot explain why it works I also don't know how datamatrix work. For me it was more luck. I searched the original issue's comments. It noted that an other software fixed it. I looked into their fix and found
if (symbols_left <= 2) // Unlatch not required!.
I couldn't find a similar approach in datamatrix.php so I randomly changed some number to 2.
Thank you ! You can also have a look at #537 about the project maintenance
I saw that this issue was reported before on an other site in 2017 but I couldn't find any solution.
The issue occurs when creating a so called MAT Label. The following code is used: $pdf->write2DBarcode("@06@12S0002@PA9D8000000000@1P70431188AB@31P04311880AB@12V12345678@10VABC-DEFGHIJ@2PAB@20P@6D20170505@14D20180121@30P@ZN@K0042035913@16K293679", 'DATAMATRIX', 16, 16, 25, 25, array(), 'N');
The ouput when scanning the datamatrix is: @06@12S0002@PA9D8000000000@1P70431188AB@31P04311880AB@12V12345678@10VABC-DEFGHIJ@2PAB@20SXSKCG~o82~s~+097~q66~P@ZN/CCSKCOW'GLCGX/K'OY<4XE&?IP+0U#.!!63R.A7~
Preview of the datamatrix: https://sourceforge.net/p/tcpdf/bugs/1133/attachment/dm.jpg