Reputation: 3634
How to add hyper link on image in generated PDF using tcpdf
I am using below code to generate bar code. I want to add hyperlink on bar code.
$pdf->write2DBarcode("text goes here", 'QRCODE,H', 30, 380, 75, 75, '', 'N');
Upvotes: 1
Views: 2510
Reputation: 2476
You can output the barcode in various formats. See the examples/barcodes
directory in the framework library. One of those formats is HTML. Maybe try using that and the writeHTML
method:
// You should have this file in the library:
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('BARCODE TEXT', 'DATAMATRIX');
// output the barcode as HTML object
$barcodeHTML = $barcodeobj->getBarcodeHTML(6, 6, 'black');
$html = '<a href="http://www.google.com">' . $barcodeHTML . '</a>';
$pdf->writeHTML($html, true, false, true, false, '');
Upvotes: 0