1 (edited by apmuthu 01/14/2013 09:53:13 am)

Topic: addLink => AddLink, link text parameter?

The function AddLink is defined in class TCPDF in line 2722 of reporting/includes/tcpdf.php.

This class TCPDF extended by class FPDF in reporting/includes/fpdi/fpdi2tcpdf_bridge.php .

The class FPDF is further extended by class FPDF_TPL in reporting/ncludes/fpdi/fpdf_tpl.php where the error override function AddLink is defined in Line 306 to redirect to it's namesake in the original grandparent class TCPDF.

FPDF_TPL is now extended by class FPDI in reporting/includes/fpdi/fpdi.php

There is no reference to the function addLink() in any of these classes (note case). The function addLink is used twice in reporting/includes/header2.inc :

Line 116:

$this->addLink($url, $c2col, $this->row, $mcol, $this->row + $this->lineHeight);

Line 202:   

$this->addLink($txt, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight);

If we assume that it is a typo and correct it to AddLink, then the function description states that it is an internal link within the document only but our usage in FA is for external links which require the SetLink method of TCPDF.

Commenting out the said lines (tested commenting out line 202) results in no loss in functionality - the link is clickable in the PDF. This means that when any URL is sent to the TextWrap method that preceeded the addLink, it will intelligently be rendered clickable.

Which parameter is then to be used in setting the display text for the link if it needs to be other than the url?

Re: addLink => AddLink, link text parameter?

Well, frankly speaking, I am not sure. It is several years since this link to paypal was added. And of course it is only good when viewing the document in the pdf reader.

apmuthu, you are mostly on your own here. Please test it and see.

/Joe

3 (edited by apmuthu 01/14/2013 01:17:26 pm)

Re: addLink => AddLink, link text parameter?

Fixed this issue natively using TCPDF class base methods itself. Fully backwards compatible from TCPDF induction into FA onwards.

Patch for reporting/includes/header2.inc attached.
This patch is for current Mercurial Build 3135.

Post's attachments

FA_header2_inc_patch.zip 911 b, 8 downloads since 2013-01-14 

You don't have the permssions to download the attachments of this post.

Re: addLink => AddLink, link text parameter?

The link does not work from the pdf-reader.

The full link before (the ugly one if you like) worked like it should.
And for those who have a printed copy, they can just enter the link as is in the browser and they can pay it this way too.

/Joe

Re: addLink => AddLink, link text parameter?

Which PDF reader?

Adobe Acrobat / SumatraPDF Readers work.

Re: addLink => AddLink, link text parameter?

Foxit reader!

/Joe

Re: addLink => AddLink, link text parameter?

It works with latest Foxit Reader v5.4.4 on WinXP SP3. See screenshots.

In Foxit Reader:
Edit -> Preferences -> Trust Manager -> Enable Safe Reading Mode -> Uncheck

All recent versions of PDF Readers disallow Web access by default. We need to enable it when we are sure.