问题
I am using tcpdf to generate datamatrix barcodes. Works really nice. Now I was asked if we could add fnc1 characters to our code. But I have no clue what the representation of the fnc1 character would be correct for the tcpdf generator. I came across this here http://sourceforge.net/p/tcpdf/discussion/435311/thread/161b1b1a
But I would like to understand where the answer of using chr(241)
actually comes from. To me it seems like it fell from the sky. Documentation doesn't say anything about it and I have not found anywhere else that chr(241)
would be a representation of the fnc1 character.
Apart from that, it doesn't work for me, scanning the barcode just results in ñ
characters in the middle of the code.
Anyone an idea how I could get the fnc1 character into my tcpdf datamatrix? What am I missing? Thanks for help in advance!
$string = chr(241).str_replace(";", chr(241), $string);
$barcodeobj = new TCPDF2DBarcode();
$barcodeobj->setBarcode($string, 'DATAMATRIX');
$barcodeobj->getBarcodeSVGcode(6, 6, 'black');
回答1:
Looking at the code for version 1.0.008 (from 2014-05-06) in /tcpdf/include/barcodes/datamatrix.php
I cannot see any comprehensive treatment of the special function or macro characters in Data Matrix so you are probably out of luck.
That said, the forum reply to which you link was written by the author of the TCPDF (Nicola Asuni) so it might we worth reaching out to him to see what he was thinking at the time. My guess would be that an example input used by some other library had mislead him into believing that FNC1 can be represented as an ordinary code point, however this is wrong since FNC1 is a non-data character that requires special treatment.
来源:https://stackoverflow.com/questions/33093751/add-a-fnc1-character-to-code-created-with-tcpdf-datamatrix