THotPDF.AddLoadedTextField Method
Adds a text field to a page of the loaded document and registers it in the AcroForm. The field receives an appearance stream showing its value, and the AcroForm receives the Helvetica default font its /DA string names, so every viewer shows the field
Declaration
function AddLoadedTextField(PageIndex: Integer; X1, Y1, X2, Y2: Single; const AFieldName, AValue: AnsiString; AMaxLen: Integer): Integer;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
PageIndex | Zero-based index of the loaded page upon which the widget is placed |
X1 | Left-hand edge of the widget rectangle in PDF user space (points, origin at the bottom-left corner of the page) |
Y1 | Bottom edge of the widget rectangle in PDF user space |
X2 | Right-hand edge of the widget rectangle in PDF user space |
Y2 | Top edge of the widget rectangle in PDF user space |
AFieldName | Name of the new field; it must not already be present in the loaded form |
AValue | Initial value; empty for a blank field |
AMaxLen | Greatest number of characters, or 0 for no limit |
Return value
Index of the new field, for use alongside the other loaded form field methods, or -1 when PageIndex is out of range
Usage notes
- Use this API in the AcroForm workflow before the affected page, resource, field or catalogue object is finalised
- Keep object names, field names, resource names and returned handles stable until the document is finalised
- Loaded-document object references may be indirect; resolve arrays, dictionaries or streams before inspecting nested values