I use TCPDF to create PDF documents in PHP. The latest TCPDF supports 1D and 2D barcodes. I successfully displayed the barcode as described in the documentation, for example:
require_once('tcpdf_barcodes_1d.php'); $barcodeobj = new TCPDFBarcode('some_text', 'C128'); $barcode = $barcodeobj->getBarcodeHTML(1, 20, 'black'); echo $barcode;
It works great. The generated barcode is not an image and is a combination of absolutely positioned div s.
It also supports the creation of PNG barcodes, for example:
$barcodeobj->getBarcodePNG(2, 30, array(0,0,0));
and SVG, for example:
$barcodeobj->getBarcodeSVG(2, 30, 'black');
In the case of PNG, it automatically displays the image in the browser. She doesn't need an echo, or a seal, or anything else.
I need to print a barcode in a PDF file. I use the TCPDF writeHTML() method to create PDF files, and I want to use this method here, since I have other things to print along with the barcode. How can I create a PDF with barcodes in it using the writeHTML() method (for example, inside the <img> )?
Thanks in advance ... :)
source share