Teknisk artikel

PDFlibPas: PDF/A and PDF/UA preflight in Delphi

losLab PDF Library ger Delphi- och C++Builder-team en PDF-motor med tillgänglig källkod för skrivbord, server, DLL, ActiveX och Dylib, med inbyggda PDF/A- och PDF/UA-kontroller, PAdES-signering och valbara renderare utan extern PDF-tjänst.

Den här artikeln är skriven för developers delivering archive-ready and accessibility-aware PDFs from Delphi systems. Den behandlar PDF/A and PDF/UA preflight som produktionsnära dokumentteknik, inte som ett isolerat komponentanrop.

Den praktiska risken är att PDF/A and PDF/UA failures usually reflect document design decisions, so late preflight without ownership produces lists of issues nobody can fix. Därför behöver flödet ett skrivet kontrakt, observerbar diagnostik och realistiska regressionsfiler.

Arkitekturbeslut

Connect preflight findings to template ownership. target PDF/A profile, PDF/UA expectations, and accepted validator set / font, metadata, color, annotation, form, and attachment policies

  • target PDF/A profile, PDF/UA expectations, and accepted validator set
  • font, metadata, color, annotation, form, and attachment policies
  • tag structure, heading order, table markup, alternate text, and artifacts
  • issue ownership and release-gate severity mapping

Implementeringsflöde

Treat diagnostics as product requirements. Ordningen nedan gör arbetsflödet granskbart för Delphi- och C++Builder-team.

  1. configure document generation around the target profiles before output
  2. run structured preflight and normalize findings by owner and severity
  3. route template issues to template maintainers and data issues to application owners
  4. rerun validation after each fix rather than relying on visual inspection
  5. ship the report with the document package when customers require evidence

Valideringsbevis

Preflight evidence for archive and accessibility workflows. Behåll dessa fält tillsammans med utdata eller supportunderlaget.

  • profile, validator version, issue code, severity, page, object, and owner
  • font embedding, output intent, metadata, and attachment findings
  • tagging diagnostics such as heading order, table structure, artifacts, and alternate text
  • release decision, waivers, and final pass or fail report

Archive and accessibility profiles ask different questions

PDF/A focuses on durable reproduction while PDF/UA focuses on semantic access. A production workflow should keep both validation profiles visible and assign findings to generation code, templates, or content owners.

Review questions before release

Before this reaches production, the team should be able to answer these questions without reading source code.

  • Who owns target PDF/A profile, PDF/UA expectations, and accepted validator set?
  • What evidence proves profile, validator version, issue code, severity, page, object, and owner?
  • What happens when an archive-valid file can still have poor reading order?
  • Which regression file covers ship the report with the document package when customers require evidence?

Tekniska granskningsnoteringar för PDF/A and PDF/UA preflight

Använd dessa granskningsnoteringar för att säkerställa att funktionen har passerat demo-nivån och kan försvaras under leverans, support och kundeskalering.

  • Beslut: target PDF/A profile, PDF/UA expectations, and accepted validator set. Implementeringspresspunkt: run structured preflight and normalize findings by owner and severity. Acceptansbevis: tagging diagnostics such as heading order, table structure, artifacts, and alternate text. Regressionsutlösare: third-party inserted pages can break profile assumptions late in assembly
  • Beslut: font, metadata, color, annotation, form, and attachment policies. Implementeringspresspunkt: route template issues to template maintainers and data issues to application owners. Acceptansbevis: release decision, waivers, and final pass or fail report. Regressionsutlösare: an archive-valid file can still have poor reading order
  • Beslut: tag structure, heading order, table markup, alternate text, and artifacts. Implementeringspresspunkt: rerun validation after each fix rather than relying on visual inspection. Acceptansbevis: profile, validator version, issue code, severity, page, object, and owner. Regressionsutlösare: decorative content should be marked as artifacts instead of hidden visually only
  • Beslut: issue ownership and release-gate severity mapping. Implementeringspresspunkt: ship the report with the document package when customers require evidence. Acceptansbevis: font embedding, output intent, metadata, and attachment findings. Regressionsutlösare: forms and annotations can conflict with archive goals depending on profile

Gränsfall

  • an archive-valid file can still have poor reading order
  • decorative content should be marked as artifacts instead of hidden visually only
  • forms and annotations can conflict with archive goals depending on profile
  • third-party inserted pages can break profile assumptions late in assembly

Delphi / C++Builder notes

PDFlibPas 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 PDF/A, PDF/UA, CreatePreflightReportEx, accessibility, tag structure, validator.

Delphi-kodexempel

Följande Delphi-skiss visar en praktisk servicegräns för detta ämne. Håll policykontroller, loggning och validering utanför det smala produktanropet så att arbetsflödet går att testa.

procedure RunStandardsPreflight(const InputFile, ReportFile: string; const Profile: string);
var
  Pdf: TPDFlib;
begin
  Pdf := TPDFlib.Create;
  try
    Pdf.LoadFromFile(InputFile, '');
    TFile.WriteAllText(ReportFile, BuildStandardsReport(Pdf, Profile), TEncoding.UTF8);
    FailOnBlockingStandardsIssues(ReportFile);
  finally
    Pdf.Free;
  end;
end;

Produktionschecklista

  • Kör arbetsflödet på en tom fil, en normal kundfil och en värstafallfil
  • Öppna den genererade PDF-filen med rätt visare, validator, skrivare eller nedströmsapplikation
  • Logga produktversion, profilversion, inmatningshash, utdatasökväg, förfluten tid och antal varningar
  • Håll lösenord, certifikat, tillfälliga filer och kunddata under tydliga lagringsregler
  • Lägg till regressionsdokument när en kundfil avslöjar ett nytt gränsfall

Produktdokumentation

PDFlibPas

Fler kodexempel

var
  Pdf: TPDFlib;
  Diag: WideString;
begin
  Pdf := TPDFlib.Create;
  try
    Pdf.NewDocument;
    Pdf.SetPDFAMode(1);
    Pdf.LoadOutputIntentProfile('sRGB-IEC61966-2.1.icc', 'RGB');
    Pdf.SetPDFUAMode('en-US');
    Pdf.SetInformation(1, 'Quarterly Statement');  // /Title: required for PDF/UA
    // ... draw tagged content here ...
    Diag := Pdf.GetPDFUADiagnostics;
    if Diag <> '' then
      Writeln('fix before shipping: ', Diag);
    Pdf.SaveToFile('statement.pdf');
    // the preflight that counts runs on the saved file:
    Writeln(Pdf.CreatePreflightReport('statement.pdf', '', 1, 0));
  finally
    Pdf.Free;
  end;
end;