技術記事

HotPDF Component: Delphi での PDF/A, PDF/X, and PDF/UA validation

HotPDF は Delphi/C++Builder アプリケーション向けのネイティブ VCL PDF ライブラリです。外部 PDF ランタイムを配置せずに、PDF 作成、編集、フォーム、注釈、暗号化、デジタル署名、Unicode フォント、標準対応出力、プリフライトレポートを扱えます。

この記事は teams that deliver archival, print, or accessibility-sensitive PDF output from Delphi applications 向けです。PDF/A, PDF/X, and PDF/UA validation を単なるコンポーネント呼び出しではなく、本番向けのドキュメントエンジニアリングとして扱います。

実務上のリスクは a document can pass a visual review while missing fonts, output intents, tagged structure, metadata, or accessibility semantics required by the target standard です。そのため、明確な契約、観測可能な診断、実際の顧客ファイルに近い回帰サンプルが必要です。

アーキテクチャ上の判断

Select the standard before generating pages. target profile and conformance level for each output channel / font embedding, color profile, metadata, and transparency policy

  • target profile and conformance level for each output channel
  • font embedding, color profile, metadata, and transparency policy
  • tagging, reading order, alternate text, and artifact treatment
  • whether validation warnings block release or require documented waivers

実装フロー

Use preflight findings as engineering requirements. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. select the compliance profile before creating the first page object
  2. configure fonts, images, color spaces, metadata, and tagging around that profile
  3. run preflight after generation and parse findings into actionable categories
  4. fix the document source instead of patching the PDF when the issue is template-owned
  5. save the validation report with the output package or support evidence

検証エビデンス

Validation artifacts for release and support. Keep these fields with the output or support record.

  • profile name, validator version, pass or fail status, and issue severity counts
  • font, color, metadata, tag-structure, and annotation findings
  • waiver owner and business reason for every accepted warning
  • sample output opened in the target archive, print, or accessibility workflow

Compliance choices affect layout and content

PDF/A, PDF/X, and PDF/UA optimize for different guarantees. A single document may not satisfy every profile without tradeoffs in color management, interactivity, transparency, tagging, or embedded content.

Operational metrics to watch

The first release should expose enough metrics to prove the workflow is healthy under real files, not only under curated samples.

  • count and rate for profile name, validator version, pass or fail status, and issue severity counts
  • warning trend for interactive forms and JavaScript may conflict with archival profiles
  • latency of the stage that must select the compliance profile before creating the first page object
  • profile usage for target profile and conformance level for each output channel

PDF/A, PDF/X, and PDF/UA validation に関する技術レビューの注意点

これらのレビュー項目を使って、機能がデモ段階を超え、リリース、サポート、顧客エスカレーションの場で説明できることを確認します

  • 判断: target profile and conformance level for each output channel. 実装上の焦点: configure fonts, images, color spaces, metadata, and tagging around that profile. 受け入れ証拠: waiver owner and business reason for every accepted warning. 回帰の引き金: third-party template assets often introduce fonts or transparency outside policy
  • 判断: font embedding, color profile, metadata, and transparency policy. 実装上の焦点: run preflight after generation and parse findings into actionable categories. 受け入れ証拠: sample output opened in the target archive, print, or accessibility workflow. 回帰の引き金: interactive forms and JavaScript may conflict with archival profiles

境界ケース

  • interactive forms and JavaScript may conflict with archival profiles
  • print-ready color requirements do not automatically satisfy accessibility needs
  • tagged PDF repair late in the process is expensive and error-prone
  • third-party template assets often introduce fonts or transparency outside policy

Delphi / C++Builder の補足

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. 重要な用語には PDF/A, PDF/X, PDF/UA, preflight, output intent, tagged PDF.

Delphi コード例

次の Delphi スケッチは、このテーマに対する実用的なサービス境界を示します。ポリシー確認、ログ記録、検証を製品呼び出しの狭い部分の外側に置くと、ワークフローをテストしやすくなります。

procedure ExportStandardsAwarePdf(const OutputFile: string; const ProfileName: string);
var
  Pdf: THotPDF;
  Report: string;
begin
  Pdf := THotPDF.Create(nil);
  try
    Pdf.FileName := OutputFile;
    ConfigureStandardsProfile(Pdf, ProfileName);
    Pdf.BeginDoc;
    WriteTaggedContent(Pdf);
    Pdf.EndDoc;
    Report := Pdf.CreatePreflightReport(OutputFile);
    FailBuildOnPreflightErrors(Report);
  finally
    Pdf.Free;
  end;
end;

本番チェックリスト

  • ワークフローは、空のファイル、通常の顧客ファイル、最悪ケースのファイルで実行します
  • 生成された PDF は、対象のビューアー、検証ツール、プリンター、または downstream アプリケーションで開きます
  • 製品バージョン、プロファイルバージョン、入力ハッシュ、出力パス、経過時間、警告数を記録します
  • パスワード、証明書、一時ファイル、顧客データは明確な保持ルールの下で管理します
  • 顧客ファイルが新しい境界ケースを示したら、回帰用ドキュメントを追加します

製品ドキュメント

HotPDF Component

追加のコード例

Pdf.PDFXCompliance := 'X-1a';
Pdf.Trapped := 'Unknown';        // mandatory key under ISO 15930
ICC := TFileStream.Create('FOGRA39.icc', fmOpenRead);
try
  Pdf.AddPDFXOutputIntent('FOGRA39 (ISO 12647-2:2004)', '', ICC, 4, 'DeviceCMYK');
finally
  ICC.Free;
end;
Pdf.BeginDoc;
// draw with CMYK-safe colors, no transparency, no encryption
Pdf.EndDoc;
Pdf.PDFUACompliance := True;     // auto-enables tagged PDF
Pdf.Lang := 'en-US';             // set explicitly; empty falls back to 'en'
Pdf.BeginDoc;

Root := Pdf.AddStructureElement(sstDocument, nil);
H1 := Pdf.EmitTaggedHeading(1, Root, 50, 700, 'Quarterly Report');
Para := Pdf.BeginTaggedContent('P', Root);
Pdf.CurrentPage.TextOut(50, 650, 0, 'Revenue grew in all regions.');
Pdf.EndTaggedContent;

Pdf.EndDoc;