THotPDF.CreateLoadedFieldWidget Method
On a specified page of the loaded PDF, creates a new form field control dictionary with a given field name and position rectangle, used to append interactive form controls to existing PDF documents
Declaration
function CreateLoadedFieldWidget(PageIndex: Integer; const AFieldName: AnsiString; ARect: THPDFRect): THPDFDictionaryObject;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
PageIndex | Zero-based index of the target page, specifying the page to which the control belongs |
AFieldName | The unique name of the new field, which must not clash with existing fields in the same document |
ARect | The position and size rectangle of the control on the page, using the PDF coordinate system (origin at the bottom-left corner of the page) |
X2 | Input supplied to CreateLoadedFieldWidget |
Y2 | Input supplied to CreateLoadedFieldWidget |
AFieldName | AcroForm field name or field dictionary targeted by the helper |
AFieldType | AcroForm field name or field dictionary targeted by the helper |
AFlags | Input supplied to CreateLoadedFieldWidget |
Return value
Returns a dictionary object representing the newly created field widget
The complete signed Integer AFlags bit pattern is retained in the new field's /Ff entry, including high bits together with the common field flags
See AcroForm field flag precision for signed mask values, inheritance and native builder behaviour
Usage notes
- Call EnsureLoadedAcroForm first so the AcroForm dictionary exists
- The new widget is registered on the target page immediately; call a save method to write it to the output
- The returned dictionary object's lifecycle is managed by the document; the caller must not manually free it, and object references will become invalid after saving the document