AddLinkToImportData

Annotations and hotspot links, Form fields and AcroForms

Description

Adds a clickable hotspot rectangle to the selected page which triggers a PDF import-data action when activated. An import-data action populates the document's AcroForm fields from a Forms Data Format (FDF) file on disk. The action is defined in ISO 32000-1 §12.6.4.8, Table 198.

Typical use: a “Reload sample data” or “Reset to defaults” link in an interactive form, where the FDF file ships alongside the PDF and holds the canonical field values.

Use the SetAnnotBorderColor function to change the color of the hotspot border.

Syntax

Delphi

Function TPDFlib.AddLinkToImportData(Left, Top, Width, Height: Double; Const FileName: WideString; Options: Integer): Integer;

ActiveX

Function PDFlib::AddLinkToImportData(Left As Double, Top As Double, Width As Double, Height As Double, FileName As String, Options As Long) As Long

Available on IPDFlibrary5 from type library version 3.6

DLL

int DLAddLinkToImportData(int InstanceID, double Left, double Top, double Width, double Height, const wchar_t* FileName, int Options);
int DLAddLinkToImportDataA(int InstanceID, double Left, double Top, double Width, double Height, const char* FileName, int Options);

Parameters

LeftThe horizontal co-ordinate of the left edge of the hotspot rectangle
TopThe vertical co-ordinate of the top edge of the hotspot rectangle
WidthThe width of the hotspot rectangle
HeightThe height of the hotspot rectangle
FileNameThe path to the FDF file from which the form fields will be populated. Backslashes are converted to forward-slashes per ISO 32000-1 §7.11.2.1 PDF-canonical path form. The file does not need to exist at PDF-creation time but must be present at viewing time for the action to succeed.
OptionsBitmask controlling the link appearance. Bit 0 (value 1): draw a border around the hotspot rectangle. Bits 1–3 select the click highlight mode (2 = Invert, 4 = Outline, 8 = Push); when no highlight bit is set, Invert is used as the default. Same convention as AddLinkToWeb / AddLinkToHideField.

Return values

Returns 1 when the link has been added. Returns 0 in PDF/A documents and in PDF/X-4 and later, where import-data actions are not permitted.

Remarks

PDF/A and PDF/X-6 modes reject ImportData actions and return 0 without adding an annotation; PDF 1.4 or later is required