AddRelativeLinkToLocalFile
Annotations and hotspot links
Description
Adds a clickable hotspot rectangle to the selected page which links using relative path to a local file.
The file doesn't have to exist when the PDF is created but should exist when the PDF is viewed for the link to work.
Use the SetAnnotBorderColor function to change the colour of the hotspot border.
Syntax
Delphi
Function TPDFlib.AddRelativeLinkToLocalFile(Left, Top, Width, Height: Double; Const FileName: WideString; Options: Integer): Integer;
ActiveX
Function PDFlib::AddRelativeLinkToLocalFile(Left As Double, Top As Double, Width As Double, Height As Double, FileName As String, Options As Long) As Long
DLL
int DLAddRelativeLinkToLocalFile(int InstanceID, double Left, double Top, double Width, double Height, const wchar_t* FileName, int Options);
int DLAddRelativeLinkToLocalFileA(int InstanceID, double Left, double Top, double Width, double Height, const char* FileName, int Options);
Parameters
| Left | The horizontal co-ordinate of the left edge of the hotspot rectangle. With a font selected and centre or right text alignment active, it is the centre or the right edge instead, as for DrawText |
|---|---|
| Top | The vertical co-ordinate of the top edge of the hotspot rectangle. With a font selected, unless drawing to a canvas DC, the rectangle is placed below this value by the font-top offset of that font, the current text rise included, so a link over a line of text takes the same Top as the text |
| Width | The width of the hotspot rectangle |
| Height | The height of the hotspot rectangle |
| FileName | The full absolute path and file name of the PDF document to link to, it will be converted to relative path. |
| Options | Specifies the appearance of the link: 0 = No border 1 = Draw a border |
Return values
Returns 1 when the link has been added, and 0 when it was not, in which case nothing is written to the page: no page is selected, Width or Height is zero or negative, or FileName is empty.