Php 使用tcpdf链接PDF中的图像

Php 使用tcpdf链接PDF中的图像,php,tcpdf,Php,Tcpdf,如何使用tcpdf在生成的PDF中的图像上添加超链接 我使用下面的代码生成条形码。我想在条形码上添加超链接 $pdf->write2DBarcode("text goes here", 'QRCODE,H', 30, 380, 75, 75, '', 'N'); 您可以使用在条形码下方创建链接区域 TCPDF::Link($x, $y, $w, $h, $link, $spaces = 0) 您可以以各种格式输出条形码。请参阅框架库中的examples/barcode目录。其中一种格

如何使用tcpdf在生成的PDF中的图像上添加超链接

我使用下面的代码生成条形码。我想在条形码上添加超链接

$pdf->write2DBarcode("text goes here", 'QRCODE,H', 30, 380, 75, 75, '', 'N');
您可以使用在条形码下方创建链接区域

TCPDF::Link($x, $y, $w, $h, $link, $spaces = 0)


您可以以各种格式输出条形码。请参阅框架库中的
examples/barcode
目录。其中一种格式是HTML。也许可以尝试使用该方法和
writeHTML
方法:

// 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, '');
//库中应该有此文件:
require_once(dirname(__文件__)。'/tcpdf_barcodes_2d_include.php');
//设置条形码内容和类型
$barcodeobj=新的TCPDF2DBarcode(‘条形码文本’、‘数据矩阵’);
//将条形码作为HTML对象输出
$barcodeHTML=$barcodeobj->getBarcodeHTML(6,6,'black');
$html='';
$pdf->writeHTML($html,true,false,true,false,”);

添加如下链接,$pdf->write2DBarcode('www.google.com','QRCODE',H,30380,75','N');根据,@user3040610注释中的代码应该可以工作。是否正在pdf上创建条形码?当您通过程序读取条形码时,值是否与预期值一致?这是生成条形码的代码,但我想在条形码上进行超链接
// 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, '');