기술 문서

HotPDF Component: Delphi에서 XFA, AcroForm, and flattening decisions

HotPDF는 Delphi 및 C++Builder 애플리케이션을 위한 네이티브 VCL PDF 라이브러리입니다. 외부 PDF 런타임 배포 없이 PDF 생성, 편집, 양식, 주석, 암호화, 디지털 서명, Unicode 글꼴 처리, 표준 지향 출력, 프리플라이트 보고를 지원합니다.

이 글은 teams receiving mixed form documents that must be archived, reviewed, or converted by a Delphi workflow을 위한 글입니다. XFA, AcroForm, and flattening decisions을 단순한 컴포넌트 호출이 아니라 운영 환경의 문서 엔지니어링으로 다룹니다.

실제 위험은 dynamic XFA, static XFA, and AcroForm fields behave differently, so a naive flattening step can lose values or preserve hidden state unexpectedly입니다. 따라서 명확한 계약, 관찰 가능한 진단, 실제 고객 파일을 반영한 회귀 샘플이 필요합니다.

아키텍처 결정

Identify the form technology before changing it. how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms / whether unsupported dynamic behavior blocks processing or creates a warning

  • how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms
  • whether unsupported dynamic behavior blocks processing or creates a warning
  • appearance refresh policy for changed values and calculated fields
  • retention of original form data after a flattened archive copy is produced

구현 흐름

Refresh visible appearances before flattening. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. inspect the document catalog and form dictionaries before loading values
  2. classify the form model and choose a profile that matches the business goal
  3. apply values, refresh appearances, and validate required fields
  4. flatten only the fields approved by policy and verify remaining interactivity
  5. save the classification and flattening result in the support report

검증 증거

Flattening evidence for auditors and support. Keep these fields with the output or support record.

  • form model classification, field count, XFA presence, and unsupported feature list
  • appearance refresh status for every field changed by the workflow
  • flattened field count, remaining interactive field count, and output hash
  • side-by-side viewer result for at least one customer-like form

Flattening is a finalization step

Flattening should happen only after the workflow knows which form model owns the value, which appearance is authoritative, and whether the resulting PDF must remain interactive or become a static record.

Regression files worth keeping

Keep more than successful samples. A useful XFA, AcroForm, and flattening decisions regression set contains normal files, boundary files, and intentional failure files so the behavior is stable across releases.

  • dynamic XFA forms may depend on behavior outside normal AcroForm processing
  • hidden fields can contain values that should not appear in a flattened copy
  • flattening invalid values can make correction impossible for downstream users
  • different viewers may choose different appearances when streams are stale
  • inspect the document catalog and form dictionaries before loading values
  • classify the form model and choose a profile that matches the business goal

Engineering review notes for XFA, AcroForm, and flattening decisions

Use these review notes to make sure the feature has moved beyond a demo and can be defended during release, support, and customer escalation.

  • Decision: how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms. Implementation pressure point: classify the form model and choose a profile that matches the business goal. Acceptance evidence: flattened field count, remaining interactive field count, and output hash. Regression trigger: different viewers may choose different appearances when streams are stale
  • Decision: whether unsupported dynamic behavior blocks processing or creates a warning. Implementation pressure point: apply values, refresh appearances, and validate required fields. Acceptance evidence: side-by-side viewer result for at least one customer-like form. Regression trigger: dynamic XFA forms may depend on behavior outside normal AcroForm processing
  • Decision: appearance refresh policy for changed values and calculated fields. Implementation pressure point: flatten only the fields approved by policy and verify remaining interactivity. Acceptance evidence: form model classification, field count, XFA presence, and unsupported feature list. Regression trigger: hidden fields can contain values that should not appear in a flattened copy
  • Decision: retention of original form data after a flattened archive copy is produced. Implementation pressure point: save the classification and flattening result in the support report. Acceptance evidence: appearance refresh status for every field changed by the workflow. Regression trigger: flattening invalid values can make correction impossible for downstream users
  • Decision: how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms. Implementation pressure point: inspect the document catalog and form dictionaries before loading values. Acceptance evidence: flattened field count, remaining interactive field count, and output hash. Regression trigger: different viewers may choose different appearances when streams are stale

경계 사례

  • dynamic XFA forms may depend on behavior outside normal AcroForm processing
  • hidden fields can contain values that should not appear in a flattened copy
  • flattening invalid values can make correction impossible for downstream users
  • different viewers may choose different appearances when streams are stale

Delphi / C++Builder notes

HotPDF Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include XFA, AcroForm, flattening, appearance stream, field value, archive copy.

Delphi 코드 예제

다음 Delphi 스케치는 이 주제에 맞는 실무형 서비스 경계를 보여 줍니다. 정책 검사, 로깅, 검증을 좁은 제품 호출 구간 밖에 두면 워크플로를 테스트하기 쉽습니다.

procedure FlattenIncomingForm(const InputFile, OutputFile: string; const Policy: TFormPolicy);
var
  Pdf: THotPDF;
begin
  Pdf := THotPDF.Create(nil);
  try
    LoadCustomerForm(Pdf, InputFile);
    NormalizeXfaPackets(Pdf, Policy);
    FlattenVisibleAcroFormFields(Pdf);
    SaveFlattenedCopy(Pdf, OutputFile);
    VerifyNoEditableFields(OutputFile);
  finally
    Pdf.Free;
  end;
end;

운영 체크리스트

  • Run the workflow on an empty file, a normal customer file, and a worst-case file
  • Open the generated PDF with the target viewer, validator, printer, or downstream application
  • Log product version, profile version, input hash, output path, elapsed time, and warning count
  • Keep passwords, certificates, temporary files, and customer data under explicit retention rules
  • Add regression documents when a customer file exposes a new edge case

Product documentation

HotPDF Component