Advanced AcroForm Processing

HotPDF can recalculate loaded fields, regenerate standards-based variable-text appearances, resolve annotation appearance states, and flatten a selected field set without rewriting untouched pages

Calculation order

RecalculateLoadedFormFields follows the loaded /AcroForm /CO array and evaluates the bounded AFSimple_Calculate operations SUM, AVG, PRD, MIN, and MAX through the safe field-script evaluator

ApplyLoadedFieldCalculation installs the calculation action and adds the target field to /CO without duplicate entries

Safe field scripts

EvaluateLoadedFieldJavaScript evaluates only declarative calculation and validation statements associated with the requested field trigger

Variable-text appearances

EnsureLoadedFieldAppearanceStream walks every widget and inherits /DA, /Q, /V, /DV, /Ff, and /MaxLen values from the field hierarchy or AcroForm

Annotation appearance states

GetLoadedAnnotationAppearanceStream resolves normal, rollover, or down appearances and falls back from rollover or down to normal

State dictionaries use /AS, inherited /V or /DV, parent state, /Off, and sole-stream fallback in that order

Selective flattening

FlattenLoadedFormFields paints only selected widget appearances into their owning pages, removes only the matching fields and annotations, and retains every untouched page and field

The default permission gate refuses structural changes under DocMDP and enforces FieldMDP All, Include, and Exclude locks before any page is modified

PDF.BeginIncrementalUpdate('SignedForm.pdf');
PDF.RecalculateLoadedFormFields;
PDF.FlattenLoadedFormFields(['Subtotal', 'Total']);
PDF.SaveIncrementalUpdate('SignedForm-updated.pdf');

Related APIs