I'm trying to create an external link on pdf file generated by TCPDF library using Cell method. I've written code something like this:
$this->pdf = new PDF();
$this->pdf->Cell(20, 10, 'Click here', 1, 0, 'L', true, 'https://example.com', 1, false, 'T', 'C');
The above code simply print the text and doesn't create a link however, if I include the link along with text on the third argument as below then only it creates a link:
$this->pdf = new PDF();
$this->pdf->Cell(20, 10, 'Click here https://example.com', 1, 0, 'L', true, 'https://example.com', 1, false, 'T', 'C');
I've also tried the accepted solution from this thread but it didn't work for me either.
Can anyone help? Thanks!
I cannot reproduce the issue with using tcpdf
6.4.4:
{
"require": {
"tecnickcom/tcpdf": "^6.4"
}
}
require_once __DIR__ . "/vendor/autoload.php";
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->AddPage();
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
$pdf->Cell(20, 10, 'Click here', 1, 0, 'L', false, 'https://example.com', 1, false, 'T', 'C');
$pdf->Output('example_004.pdf', 'I');
Can you tell me which version of the library you are using?