THotPDF Loaded Form Field Editing Methods
Updates field constraints and widget appearance dictionaries in an existing AcroForm with correct incremental saving
Native field-flag editing retains the complete 32-bit mask, including high bits and low common flags, with the existing loaded-field inheritance rules
See AcroForm field flag precision for signed mask values, inheritance and native builder behaviour
Methods
SetLoadedFormFieldFlags SetLoadedFormFieldMaxLength SetLoadedFormFieldJustification
GetLoadedFormFieldWidgetCount GetLoadedFormFieldWidgetRect SetLoadedFormFieldWidgetRect
SetLoadedFormFieldRotation SetLoadedFormFieldBorderColor SetLoadedFormFieldVisibilitySetLoadedFormFieldFlagsreplaces the complete PDF/Ffbit maskSetLoadedFormFieldMaxLengthwrites/MaxLen; zero or a negative value removes the limitTHPDFFormFieldJustificationcontainsffjLeft,ffjCenter, andffjRightfor PDF/Qvalues 0 through 2
Use SetLoadedFormFieldJustification to set field quadding, then EnsureLoadedFieldAppearanceStream to regenerate the appearance; loaded listbox labels honour the effective /Q value without changing the /TI window or stored selections
Widget geometry
function GetLoadedFormFieldWidgetCount(FieldIndex: Integer): Integer;
function GetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
out ARect: THPDFRect): boolean;
procedure SetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
X1, Y1, X2, Y2: Single);
- Field and widget indexes are zero based
- Widget enumeration exposes every
/Kidsentry of radio groups and other multi-widget fields - Rectangle endpoints use raw PDF user-space points and are normalised before writing
Widget appearance and visibility
procedure SetLoadedFormFieldRotation(FieldIndex, ADegrees: Integer);
procedure SetLoadedFormFieldBorderColor(FieldIndex: Integer;
ARed, AGreen, ABlue: Single);
procedure SetLoadedFormFieldVisibility(FieldIndex: Integer;
AVisible, APrintable: boolean);
procedure SetLoadedFormFieldBorderWidth(FieldIndex: Integer; AWidth: Single);
procedure SetLoadedFormFieldBackgroundColor(FieldIndex: Integer;
ARed, AGreen, ABlue: Single);
- Rotation accepts positive or negative multiples of 90 degrees and stores the normalised
/MK /Rvalue - Border and background RGB components are clamped to the PDF DeviceRGB range from 0 through 1
- Appearance and visibility setters update every widget belonging to the selected field
- Visibility preserves unrelated annotation flags while controlling Hidden, NoView, and Print
Incremental update behaviour
- Field, widget,
/MK, and/BSdictionaries are marked dirty at the level where each value is stored - Visual changes invalidate only the affected page's cached DPI variants
- Invalid field or widget indexes leave the document unchanged
Example
PDF.BeginIncrementalUpdate('input.pdf');
PDF.SetLoadedFormFieldMaxLength(0, 40);
PDF.SetLoadedFormFieldJustification(0, ffjCenter);
PDF.SetLoadedFormFieldRotation(0, 90);
PDF.SetLoadedFormFieldBorderColor(0, 0.1, 0.4, 0.8);
PDF.SetLoadedFormFieldWidgetRect(1, 1, 80, 150, 100, 170);
PDF.SaveIncrementalUpdate('updated.pdf');
Related APIs
Loaded form field methods · Loaded document toolkit · THotPDF