PDFium Delphi Component Docs

ValidatePdfAComplianceEx function

Unit: FPdfPdfa

Syntax

function ValidatePdfAComplianceEx(Source: TStream; const Options: TPdfAValidationOptions): TPdfAValidationResult;

Description

ValidatePdfAComplianceEx performs the same read-only PDF/A inspection as ValidatePdfACompliance but takes explicit budgets for the recursive embedded-file (PDF/A-3 and PDF/A-4f) rules

PDF/A-3 embedded MIME validation reads the active file stream dictionary. It reports pvaiEmbeddedFileSubtypeInvalid for a missing or invalid Subtype name and pvaiEmbeddedPdfAUnchecked when the active objects cannot be read within the parser limits

pvaiEmbeddedFileParamsInvalid reports a present PDF/A-3 embedded file Params value without the required dictionary and valid ModDate string. This check uses the same active object inspection and can verify the stored date's form and calendar fields

pvaiEmbeddedFileUnassociated reports an embedded file specification without a verified PDF/A-3 association. The inspection resolves /AF arrays by object number and generation and checks named Properties arrays used in balanced /AF marked content. The byte-level scan covers page content sequences and reachable Form, tiling-pattern, Type 3 glyph and appearance streams with local resources

pvaiEmbeddedFileGraphInvalid also reports a verified file association used by an /AF DP point. pvaiEmbeddedPdfAUnchecked covers unresolved association candidates, including unreadable content, legacy page-resource fallback and exhausted traversal budgets

A Form XObject or Type 3 font without /Resources now inherits the active page (or page-tree ancestor) resource dictionary when its marked content is inspected. The invoking Form's own /Resources is not used as a fallback: an independent PDF/A-3 clause 6.8 test 4 run rejects that reading for a nested Form. The page resource dictionary is resolved before /Annots is walked, so an annotation appearance stream without /Resources is classified against that context rather than reported as pvaiEmbeddedPdfAUnchecked

For PDF/A-3 related files, pvaiEmbeddedFileGraphInvalid reports an invalid RF dictionary, a missing matching filename or EF entry, or a malformed name/stream pair. The check resolves indirect arrays, filenames and stream references in the active revision. A related stream may omit Type and still receives the MIME and Params checks

The PDF/A-3 file specification check follows active EmbeddedFiles name-tree entries, dictionary and marked-content associations, and file attachment FS references. pvaiEmbeddedFileGraphInvalid covers a missing or invalid Type or a direct embedded file specification. pvaiEmbeddedFileMissingUF covers missing or invalid F and UF strings, and pvaiEmbeddedFileMissingAFRelationship covers a missing or invalid relationship name. Indirect values resolve in the active revision

PDF/A-2 through PDF/A-4 check the active annotation appearance dictionary. Its only effective entry is N, which must be a stream for ordinary annotations or a nonempty state dictionary of streams for button widgets

The PDF/A-2 and PDF/A-3 annotation type rules allow FileAttachment and Redact. The validator applies the profile's separate rules for appearance, flags and embedded file associations

Internal v3.417.10 applies the annotation dictionary, flag and appearance clauses (ISO 19005-1 6.5.3, ISO 19005-2/3 6.3.2 and 6.3.3) to the active page /Annots members. Private lookalike dictionaries stay silent; a real annotation with /F 0, /CA 0.5, an /AP entry other than /N or the ToggleNoView bit is still reported. An independent six-rule veraPDF profile confirms the private-object positive case and three real violations. Internal v3.417.11 also decides the button normal-appearance rule there, so a /FT /Btn widget with a plain /AP /N stream is reported and a lookalike object outside /Annots is not; an independent clause 6.3.3 tests 3 and 4 profile agrees on both cases. Internal v3.417.13 resolves the widget field type through /Parent, so a button whose /FT lives on its field is checked as well; the same independent profile flags that fixture and clears the state-keyed and text-field controls. Internal v3.417.12 extends the same ownership to pvaiWidgetActionForbidden: the widget /A and /AA decision runs on the active annotation, an independent clause 6.4.1 test 1 profile agrees on the four PDF/A-3 cases, and an object outside /Annots stays silent

The part-specific annotation subtype tables are checked against the single-rule expressions of the six veraPDF part profiles: PDF/A-1 (sixteen PDF 1.4 types), parts 2 and 3 (twenty-two ISO 32000-1 types) and part 4 base, 4e and 4f (twenty-two, twenty-four and twenty-three types). pvaiAnnotationTypeNotPermitted also applies to PDF/A-1 files whose active revision cannot be read

pvaiAnnotationSubtypeUnchecked reports a page tree that cannot be walked completely. Subtype policies are applied to the annotations the active page tree actually references, including indirect and escaped names and an omitted /Type; private dictionaries, similar key names and superseded revisions no longer produce findings. When the active revision itself is unreadable, conservative byte-level checks remain in force and malformed /Annots values report pvaiAnnotationDictViolation

TPdfAValidationOptions.MaxAttachmentBytes bounds the total decoded bytes of nested embedded PDF files, MaxAttachmentFiles bounds how many may be opened, and TPdfAValidationOptions.Default returns 64 MiB and 32 files. A non-positive budget stops the recursion early and the affected attachment is reported as unchecked rather than validated

These are denial-of-service guardrails for one validation call, independent of the process-wide TPdfParserResourceBudget used by the compression and rewrite chain. The maximum nesting depth remains fixed at four in the byte-level reader

Example

var
  Opts: TPdfAValidationOptions;
  R: TPdfAValidationResult;
begin
  Opts := TPdfAValidationOptions.Default;
  Opts.MaxAttachmentBytes := 8 * 1024 * 1024;
  R := ValidatePdfAComplianceEx(Stream, Opts);
end;

See Also

ValidatePdfA