Adding links to PDF files is very straight forward. A link in a PDF is actually an annotation and is placed on top of the content that you wish to link. These hotspot links can be added using the following functions:

Read more about annotations and hotspot links.

An example of how to use the AddLinkTo* functions is shown below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Add a link to a specific page in an external PDF */
 
// Set the origin for the co-ordinates to be the
// top left corner of the page.
 
DPL.SetOrigin(1);
 
// Adding a link to a page in an external PDF
// is easy using the AddLinkToFile function.
 
DPL.AddLinkToFile(200, 100, 60, 20, "Moby_Dick_NT.pdf", 22, 200, 1, 1);
 
// Hyperlinks and text are two separate
// elements in a PDF, so we'll draw some
// text now so that you know where the
// hyperlink is located on the page.
 
DPL.DrawText(205, 114, "Click me!");
 
// When the Debenu Quick PDF Library object is initiated a blank document
// is created and selected in memory by default. So
// all we need to do now is save the document to
// the local hard disk to see the changes that we've made.
 
DPL.SaveToFile("link_to_another_doc.pdf");

// Set the origin for the co-ordinates to be the
// top left corner of the page.

DPL.SetOrigin(1);

// Adding a link to a page in an external PDF
// is easy using the AddLinkToFile function.

DPL.AddLinkToFile(200, 100, 60, 20, "Moby_Dick_NT.pdf", 22, 200, 1, 1);

// Hyperlinks and text are two separate
// elements in a PDF, so we'll draw some
// text now so that you know where the
// hyperlink is located on the page.

DPL.DrawText(205, 114, "Click me!");

// When the Debenu Quick PDF Library object is initiated a blank document
// is created and selected in memory by default. So
// all we need to do now is save the document to
// the local hard disk to see the changes that we've made.

DPL.SaveToFile("link_to_another_doc.pdf");