AddLinkToSubmitForm
Annotations and hotspot links, Form fields and AcroForms
Description
Adds a clickable hotspot rectangle to the selected page which triggers a PDF submit-form action when activated. A submit-form action sends AcroForm field values to a URL or form-processing endpoint without requiring JavaScript
Use FieldNames to restrict the submitted fields. Leave FieldNames empty to let the viewer submit all applicable fields
Use the SetAnnotBorderColor function to change the color of the hotspot border
Syntax
Delphi
Function TPDFlib.AddLinkToSubmitForm(Left, Top, Width, Height: Double; Const URL, FieldNames: WideString; Flags, Options: Integer): Integer;
DLL
int DLAddLinkToSubmitForm(int InstanceID, double Left, double Top, double Width, double Height, const wchar_t * URL, const wchar_t * FieldNames, int Flags, int Options);
Parameters
| Left | The horizontal co-ordinate of the left edge of the hotspot rectangle |
|---|---|
| Top | The vertical co-ordinate of the top edge of the hotspot rectangle |
| Width | The width of the hotspot rectangle |
| Height | The height of the hotspot rectangle |
| URL | The submit target URL stored in the action file specification |
| FieldNames | Optional list of fully-qualified AcroForm field names separated by commas, semicolons, or line breaks. Leading and trailing whitespace around each name is trimmed |
| Flags | PDF submit-form action flags written to the action /Flags entry. Pass 0 for the default FDF-style submission. Common standard bits include 4 for HTML format, 32 for XFDF, and 256 for submitting the complete PDF document |
| Options | Bitmask 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 |
Return values
| 0 | The action was not added because the document is in PDF/A mode, the rectangle is invalid, or URL is empty |
|---|---|
| 1 | The link annotation and submit-form action were added |
Remarks
PDF/A mode blocks this action because it can reference an external submit target. The function requires PDF 1.2 or later