Il dizionario AcroForm viene emesso quando /Fields contiene almeno una voce oppure quando e stato registrato almeno un pacchetto XFA. I chiamanti pre-v2.119.51 che non registrano pacchetti mantengono un output /AcroForm byte-identico

 

Workflow tipico (pure XFA dynamic form)

 

PDF.BeginDoc;

TemplateBytes := TFile.ReadAllBytes('form-template.xml');

DataBytes     := TFile.ReadAllBytes('form-data.xml');

PDF.AddXFAPacket('xdp:xdp', BytesOf('<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">'));

PDF.AddXFAPacket('template', TemplateBytes);

PDF.AddXFAPacket('datasets', DataBytes);

PDF.AddXFASignaturePacket(SigBytes); { caller-generated XAdES }

PDF.AddXFAPacket('/xdp:xdp', BytesOf('</xdp:xdp>'));

PDF.EndDoc;

 

XDP wrapper, single-stream, dynamic, and signed XFA

The array /XFA form must open and close with xdp:xdp wrapper packets, as the example now shows (ISO 32000-1 §12.7.8). Related XFA APIs: SetXFADocument writes the whole XFA/XDP document as a single /XFA stream, mutually exclusive with AddXFAPacket; XFANeedsRendering sets the Catalog /NeedsRendering flag (ISO 32000-1 §7.7.2) so a viewer regenerates a dynamic XFA form on first open; AddXFASignaturePacket embeds a caller-generated XAdES / XML-DSig signature as the signature packet. HotPDF never generates or parses the signature - the caller produces it with an XML cryptographic library over the XFA datasets.

 

XFA-to-AcroForm flattening

ApplyXFAAsAcroForm mappa i byte XDP/XFA forniti dal chiamante sulla pagina corrente come widget AcroForm nativi e grafica pagina semplice. FlattenLoadedXFA esegue la stessa conversione per un PDF caricato che contiene già un pacchetto /XFA incorporato. Passare Editable=False per rendere read-only i widget generati e ispezionare XFAFlattenWarnings per gli elementi che non è stato possibile mappare

 

Vedi anche: Supporto AcroForm, THotPDF.RegisterAcroFormFont, THPDFPage.AddTextField