THPDFWindowsFormDataTransaction

HPDFWindowsFormData provides a Windows bridge from the current THotPDF graph to the native authenticated FDF/XFDF engine

Declarations

constructor Create(Document: THotPDF; OriginalSource: TStream;
  const Password: AnsiString; const Limits: THPDFWindowsFormDataLimits;
  Checkpoint: TNotifyEvent = nil);
procedure SetSignaturePolicyOptions(const Options: THPDFHeadlessCMSOptions);
function ExportData(Format: THPDFHeadlessFormDataFormat;
  const Options: THPDFHeadlessFormDataOptions): TBytes;
procedure ImportData(const Bytes: TBytes; Format: THPDFHeadlessFormDataFormat;
  const Fonts: THPDFHeadlessRichTextFonts;
  const AppearanceOptions: THPDFHeadlessTextAppearanceOptions;
  const Options: THPDFHeadlessFormDataOptions; const Password: AnsiString);
procedure ImportDataWithFamilies(const Bytes: TBytes;
  Format: THPDFHeadlessFormDataFormat; const Families: THPDFHeadlessRichTextFontFamilies;
  const AppearanceOptions: THPDFHeadlessTextAppearanceOptions;
  const Options: THPDFHeadlessFormDataOptions; const Password: AnsiString);
procedure FillTypedData(const Updates: THPDFHeadlessRichTextFieldUpdates;
  const Options: THPDFHeadlessFormDataOptions; const Password: AnsiString);
function ExportAnnotations(const Options: THPDFHeadlessXFDFOptions;
  out Bytes: SysUtils.TBytes): THPDFHeadlessXFDFExportResult;
procedure ImportAnnotations(const Bytes: SysUtils.TBytes;
  const Options: THPDFHeadlessXFDFOptions; const Password: AnsiString);
function ExportAnnotationsFDF(const Options: THPDFFDFOptions;
  out Bytes: SysUtils.TBytes): Integer;
procedure ImportAnnotationsFDF(const Bytes: SysUtils.TBytes;
  const Options: THPDFFDFOptions; const Password: AnsiString);
procedure RemoveAnnotations(
  const Identities: array of THPDFHeadlessAnnotationIdentity;
  const Options: THPDFHeadlessAnnotationRemovalOptions;
  const Password: AnsiString);
property ChangedAnnotations: Integer;
function PreparedFieldCount: Integer;
procedure GetPreparedField(Index: Integer; out Name, Value: UnicodeString;
  out FieldType: Integer);
procedure WritePreparedPDF(Destination: TStream);
procedure TakeCandidate(out Document: THotPDF;
  out Source: THPDFWindowsFormDataSource);
property ChangedFields: Integer;
property CancellationToken: THPDFCancellationToken;

Ownership and policy

Document, OriginalSource, and Checkpoint are borrowed until destruction; OriginalSource must correspond exactly to the document's loaded original revision; the constructor copies and seals a private original source, authenticates its AES credentials, and prepares the actual pending graph in another private source

The native engine checks existing signature integrity and ESS certificate binding, DocMDP permissions, FieldMDP locks, and field read-only flags; permitted P2/P3 updates regenerate genuine appearances while retaining original signed bytes

Required trust, timestamp and signed revocation checks can be configured with SetSignaturePolicyOptions; an ordinary integrity check does not imply trust in an unspecified business root

ImportData prepares one candidate PDF and one separately loaded THotPDF; it does not mutate the borrowed document; a semantically unchanged import still authenticates signed policy before copying the exact current revision

WritePreparedPDF copies bounded candidate bytes to the supplied stream; publish every required PDF and result callback successfully before TakeCandidate; failure or cancellation means discarding the transaction

TakeCandidate transfers ownership of both the THotPDF and its THPDFWindowsFormDataSource; destroy the document before destroying its source; the candidate does not retain the transaction's cancellation token

THPDFWindowsFormDataSource owns an exclusively created temporary file; Seal flushes it and reopens it for read-only access; destruction closes and removes the file; source callbacks do not outlive the owning source

ExportAnnotations and ImportAnnotations implement mapped annotation XFDF exchange; ChangedAnnotations reports the append count for mapped XFDF imports, using the same prepared-change counter as ChangedFields

Limits

FillTypedData prepares mixed scalar fields and original typed rich runs in the same candidate without an RV decoding round-trip; prepared-field accessors read the actual resulting candidate

ImportDataWithFamilies selects one through sixteen named families with actual style programs and the same authenticated candidate lifecycle; the original ImportData method keeps its single-family behavior

THPDFWindowsFormDataLimits.Default sets MaxWorkingBytes to 256 MiB, MaxOutputBytes to 128 MiB, MaxObjects to 100000, and MaxPages to 10000; working capacity must be at least 1 MiB and all other capacities must be positive

CancellationToken is borrowed and valid only until transaction destruction; it polls the original document's operation token and Checkpoint during native parsing, rich XML decoding, policy validation and copying

This Windows class is available to modern Delphi, C++Builder and Windows FPC; native Linux uses THPDFHeadlessDocument directly

Related topics

Windows FDF/XFDF exchange, Current graph preparation, Native form data

FDF annotation graphs

ExportAnnotationsFDF returns the annotation count and writes bounded binary FDF to Bytes; ImportAnnotationsFDF prepares a candidate using THPDFFDFOptions

The FDF profile retains supplied appearance resources and shared indirect objects; matching NM values on the same page select existing annotations for replacement

The FDF methods use the same borrowed-document ownership, authenticated policy and prepared-candidate lifecycle; ChangedAnnotations counts actual replacements and appends, and an equivalent import retains the exact current revision

Annotation removal

RemoveAnnotations prepares exact page-and-NM removals, including dependent popups and replies, through the same candidate lifecycle; ChangedAnnotations reports all removals once

Publish PDF and result data before TakeCandidate; failure leaves the borrowed document and source unchanged