HotPDF, harici bir PDF runtime kurmadan doğrudan PDF oluşturma ve düzenleme, formlar, notlar, şifreleme, dijital imzalar, Unicode yazı tipleri, standart odaklı çıktı ve preflight raporları gereken Delphi ve C++Builder uygulamaları için yerel bir VCL PDF kütüphanesidir.
Bu yazı teams receiving mixed form documents that must be archived, reviewed, or converted by a Delphi workflow için hazırlanmıştır. XFA, AcroForm, and flattening decisions konusunu tek bir bileşen çağrısı olarak değil, üretim düzeyinde belge mühendisliği olarak ele alır.
Pratik risk şudur: dynamic XFA, static XFA, and AcroForm fields behave differently, so a naive flattening step can lose values or preserve hidden state unexpectedly. Bu nedenle akışın yazılı sözleşmeye, gözlemlenebilir tanılara ve gerçekçi regresyon dosyalarına ihtiyacı vardır.
Mimari kararlar
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
Uygulama akışı
Refresh visible appearances before flattening. Aşağıdaki sıra, iş akışını Delphi ve C++Builder ekipleri için incelenebilir tutar.
- inspect the document catalog and form dictionaries before loading values
- classify the form model and choose a profile that matches the business goal
- apply values, refresh appearances, and validate required fields
- flatten only the fields approved by policy and verify remaining interactivity
- save the classification and flattening result in the support report
Doğrulama kanıtı
Flattening evidence for auditors and support. Bu alanları çıktı veya destek kaydıyla birlikte saklayın.
- 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
Mühendislik inceleme notları: XFA, AcroForm, and flattening decisions
Özelliğin bir demoyu aşıp sürüm, destek ve müşteri eskalasyonu sırasında savunulabilir olduğunu doğrulamak için bu inceleme notlarını kullanın.
- Karar: how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms. Uygulama baskı noktası: classify the form model and choose a profile that matches the business goal. Kabul kanıtı: flattened field count, remaining interactive field count, and output hash. Regresyon tetikleyicisi: different viewers may choose different appearances when streams are stale
- Karar: whether unsupported dynamic behavior blocks processing or creates a warning. Uygulama baskı noktası: apply values, refresh appearances, and validate required fields. Kabul kanıtı: side-by-side viewer result for at least one customer-like form. Regresyon tetikleyicisi: dynamic XFA forms may depend on behavior outside normal AcroForm processing
- Karar: appearance refresh policy for changed values and calculated fields. Uygulama baskı noktası: flatten only the fields approved by policy and verify remaining interactivity. Kabul kanıtı: form model classification, field count, XFA presence, and unsupported feature list. Regresyon tetikleyicisi: hidden fields can contain values that should not appear in a flattened copy
- Karar: retention of original form data after a flattened archive copy is produced. Uygulama baskı noktası: save the classification and flattening result in the support report. Kabul kanıtı: appearance refresh status for every field changed by the workflow. Regresyon tetikleyicisi: flattening invalid values can make correction impossible for downstream users
- Karar: how to classify AcroForm, static XFA, dynamic XFA, and hybrid forms. Uygulama baskı noktası: inspect the document catalog and form dictionaries before loading values. Kabul kanıtı: flattened field count, remaining interactive field count, and output hash. Regresyon tetikleyicisi: different viewers may choose different appearances when streams are stale
Sınır durumları
- 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 kod örneği
Aşağıdaki Delphi taslağı bu konu için pratik bir servis sınırını gösterir. Politika kontrollerini, günlüklemeyi ve doğrulamayı dar ürün çağrısı bölümünün dışında tutarak akışı test edilebilir bırakın.
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;
Üretim kontrol listesi
- İş akışını boş bir dosyada, normal bir müşteri dosyasında ve en kötü durum dosyasında çalıştırın
- Oluşturulan PDF'yi hedef görüntüleyici, doğrulayıcı, yazıcı veya aşağı akış uygulamasıyla açın
- Ürün sürümünü, profil sürümünü, giriş karmasını, çıktı yolunu, geçen süreyi ve uyarı sayısını kaydedin
- Parolaları, sertifikaları, geçici dosyaları ve müşteri verilerini açık saklama kuralları altında tutun
- Bir müşteri dosyası yeni bir uç durum ortaya çıkardığında regresyon belgeleri ekleyin
Ürün belgeleri
Ek kod örnekleri
XDPBytes := TFile.ReadAllBytes('benefit-claim.xdp');
MappedCount := Pdf.ApplyXFAAsAcroForm(XDPBytes, True);// Lock the value at field creation: read-only text field
Pdf.CurrentPage.AddTextField('CaseNumber', 'BC-2026-0117',
Rect(50, 700, 220, 720), 0, [ffReadOnly]);
// Belt and suspenders: restrict form filling document-wide
Pdf.ActivateProtection := True;
Pdf.CryptKeyLength := aes256;
Pdf.OwnerPassword := 'records-owner';
Pdf.ProtectOptions := [prPrint, prInformationCopy, prExtractContent];
// fill permission withheld: prFillAnnotations is absent from the set