I need to print a lot of 1D and 2D barcodes and add them to an html formatted document. Looking around, I found that this is possible using TCPDF methods, indeed, example No. 49 provides a solution.
$params = $pdf->serializeTCPDFtagParameters(array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); $html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
However, when implemented on my own PHP script, the barcode is not displayed. I created the test.php file, where I simply cut and pasted all the PHP code of example 49, and again just updates the contents of $ html, but has nothing specific with the $ parameters. But then again, I posted this
$pdf->write1DBarcode(...)
and it works perfectly, displays the barcode as expected, but as you know, this is not a way to place barcodes inside many html tables.
Any idea ?, I'm working on PHP 5.6 running on a Debian 7 server, the latest version of TCPDF. Also, I could not import tcpdf_include.php because it is included in the examples folder, tcpdf.php is used instead , and everything works fine.
Again, for clarification, I can generate both 1D and 2D barcodes using the write2DBarcode () method, but cannot generate barcodes using the generateserializeTCPDFtagParameters () method, which is recommended to place barcodes inside html, like indicated in example 49.
At @taxicaliโs request, this is an approximate conclusion, it works for a local parcel company that needs accurate barcodes to be read quickly by scanners.