How to add a hyperlink to your online page/resource to PDF catalog

How to add hyperlink to an online page/resource to PDF catalog

These settings will result in a PDF catalog with hyperlinks to additional online resources for each product item that requires them, a perfect PDF catalog for publishing online.

First, on the main list in the catalog, add an additional field (column), where we are going to store hyperlinks to external online resources for product items.
Click on the large GROUPS button and use any vacant field; in this case it's the fifth one (memorize this number ).

Open columns list

Next, complete (or import from the price list) this field for each item we want to add a hyperlink to. (Once the column is completed, you can hide it, as there isn't much sense in showing it to customers in the CD/DVD catalog).

fill the column

Now you need to create the actual hyperlink in the PDF catalog template.
Select the desired template in the report manager and open the template editor.

Select template

Add a new text field and format it the way you want (the screenshot shows it formatted as a recognizable hyperlink), give it a meaningful name (in the name field), in this case it's mylink

Add text block to tgemplate

Next, move on to the event tab (the text field you have just added must be selected; simply click on it to do so).

OnBeforePrint event

Double-click on the area by the onBeforePrint field; that opens a page with some code and the cursor placed between Begin and End.

Enter or paste this text:


if <frxUserDataSet1."ValueAddField#5"><>'' then
begin
	mylink.visible:=true;                                    
	mylink.url:= <frxUserDataSet1."ValueAddField#5">  
end          
else
	mylink.visible:=false;

Please note: mylink is the name of the text block we have just added to the template, and 5 is the serial number of the field, in which we store hyperlinks in our catalog (we added it on the first step of this instruction).

You are supposed to get something like this:

insert a function

That's it. Save the template and use it the way you have been using all the other templates. The hyperlinks will become visible if specified in the catalog and work in both report preview and PDF catalog.

Note: Of course, you can add a static hyperlink (e.g., to a website, purchase page, etc.) to any block in a template. Simply enter the web address of the document in the URL field.

URL value