Black
Black

Reputation: 5367

FPDI: internal link using TCPDF addLink()

I'm trying to create an internal link in my PDF using TCPDF

I create the link at the start of my document:

    $pdf = new ManualPDF ();

    $link = $pdf->addLink();
    $pdf->SetLink($link);

and then create a link to it later:

    $pdf->Write(0,'Click Here',$link);

however this doesn't work, and the Click Here text doesn't even appear clickable on the PDF (cursor is Caret).

Any guidance?

EDIT

ManualPDF is an extension of FPDI, sorry I should have mentioned that originally

Upvotes: 1

Views: 1610

Answers (1)

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21681

From the documentation, you can use the Write() method on your TCPDF object to achieve this.

For example:

//Line height 
$lh = 10;

//Indicates if the cell background must be painted (true) or transparent (false). 
$bg = false;

//L or empty string: left align (default value)
$align = 'L';

//If true set cursor at the bottom of the line, otherwise set cursor at the top of the line. 
$ln = true;

$link = 'http://www.example.com/';
$tcpdf->Write($lh, 'Example Link', $link, $bg, $align, $ln);

Would write a line with the text Google (left-aligned and with a line break, just added for a better example).

This could help you better!

Upvotes: 1

Related Questions