BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

AddInternalLink Method

Adds a clickable hyperlink to a PDF file.

void AddInternalLink(int From,
                     int To,
                     double Left,
                     double Top,
                     double Right,
                     double Bottom,
                     int DestinationPageNo,
                     prcDestinationType DestinationType,
                     double DestinationLeft,
                     double DestinationTop,
                     prcAnnotBorderStyle Style,
                     Color Color)

Sub AddInternalLink(From As Integer, _
                    To As Integer, _
                    Left As Double, _
                    Top As Double, _
                    Right As Double, _
                    Bottom As Double, _
                    DestinationPageNo As Integer, _
                    DestinationType As prcDestinationType, _
                    DestinationLeft As Double, _
                    DestinationTop As Double, _
                    Style As prcAnnotBorderStyle, _
                    Color As Color)

def AddInternalLink(self,
                    From,
                    To,
                    Left,
                    Top,
                    Right,
                    Bottom,
                    DestinationPageNo,
                    DestinationType,
                    DestinationLeft,
                    DestinationTop,
                    Style,
                    Color)
void AddInternalLink(int From,
                     int To,
                     double Left,
                     double Top,
                     double Right,
                     double Bottom,
                     int DestinationPageNo,
                     prcDestinationType DestinationType,
                     double DestinationLeft,
                     double DestinationTop,
                     prcAnnotBorderStyle Style,
                     int Color) throws PDFProcessorException

function AddInternalLink($From,
                         $To,
                         $Left,
                         $Top,
                         $Right,
                         $Bottom,
                         $DestinationPageNo,
                         $DestinationType,
                         $DestinationLeft,
                         $DestinationTop,
                         $Style,
                         $Color) 

BclPrcResult AddInternalLink(BclPDFProcessorHandle* pHandle,
                             int From,
                             int To,
                             double Left,
                             double Top,
                             double Right,
                             double Bottom,
                             int DestinationPageNo,
                             BclPrcDestinationType DestinationType,
                             double DestinationLeft,
                             double DestinationTop,
                             BclPrcAnnotBorderStyle Style,
                             BclColor Color);
Sub AddInternalLink(From As Long, _
                    To As Long, _
                    Left As Double, _
                    Top As Double, _
                    Right As Double, _
                    Bottom As Double, _
                    DestinationPageNo As Long, _
                    DestinationType As prcDestinationType, _
                    DestinationLeft As Double, _
                    DestinationTop As Double, _
                    Style As prcAnnotBorderStyle, _
                    Color As OLE_COLOR)

bepproc +HyperlinkAnnot -destPage <int>
                        -left <dimension>
                        -top <dimension>
                        -right <dimension>
                        -bottom <dimension>
                        [-pages <range> | -page <int>]
                        [-border invisible|solid|dash|underline]
                        [-width thin|medium|thick]
                        [-color <color>]
                        [-zoom fitPage|fitWidth|scroll]
                        [-scrollToX <dimension>]
                        [-scrollToY <dimension>]

Parameters

Return Values

N/A.

Remarks

Note 1: Coordinate system information:

  1. The unit size is point. 1 point = 1/72 inch (1 inch = 72 points). 1 inch = 2.54 cm = 25.4 mm.
  2. The location of the origin (0, 0) is at top-left corner.
  3. To get page size information from a PDF file, use GetPageSize method.
    The page number uses zero-based index, meaning that page numbering starts from 0.

Note 2: OLE_COLOR conversion from various programming languages:

C++:

static_cast<OLE_COLOR>(RGB(0, 0, 255))

VB6:

RGB(0, 0, 255)

VB.NET:

Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

C#:

(uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

Others:

32 bit integer value in following format: 0x00bbggrr (in BGR format, not in RGB)

For more information about color translation, refer to MSDN Knowledge Base article Q131101.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")

oProcessorHandle.AddInternalLink 0, _
                                 0, _
                                 50, _
                                 80, _
                                 370, _
                                 100, _
                                 32, _
                                 PRC_DESTINATION_FIT_PAGE, _
                                 0, _
                                 0, _
                                 PRC_BORDERSTYLE_DASHLINE_THIN, _
                                 RGB(255, 0, 0)
                                                                 
oProcessorHandle.Close

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf", Nothing)

oProcessorHandle.AddInternalLink(0, _
                                 0, _
                                 50, _
                                 80, _
                                 370, _
                                 100, _
                                 32, _
                                 prcDestinationType.PRC_DESTINATION_FIT_PAGE, _
                                 0, _
                                 0, _
                                 prcAnnotBorderStyle.PRC_BORDERSTYLE_DASHLINE_THIN, _
                                 Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 0, 0))))
                                                                        
oProcessorHandle.Close()

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\output.pdf", null);

oProcessorHandle.AddInternalLink(0,
                                 0,
                                 50, 
                                 80, 
                                 370, 
                                 100, 
                                 32, _
                                 prcDestinationType.PRC_DESTINATION_FIT_PAGE, _
                                 0, _
                                 0, _
                                 prcAnnotBorderStyle.PRC_BORDERSTYLE_DASHLINE_THIN,
                                 (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 0, 0)));
                                                                        
oProcessorHandle.Close();