PDFium Delphi Component Docs

NormalizePdfAMetadata method

Component: TPdf  ·  Unit: PDFium
Repairs ISO 19005-1 Info-to-XMP value mismatches and saves the normalized document

Syntax

function NormalizePdfAMetadata(Stream: TStream; AllowSignedDocument: Boolean = False): Boolean; overload;
function NormalizePdfAMetadata(const FileName: string; AllowSignedDocument: Boolean = False): Boolean; overload;

ResultTrue when the document was saved successfully
AllowSignedDocumentPermit a new unsigned revision after existing signatures

Description

The method compares the eight ISO 19005-1 Table 1 mappings and updates only properties required by present Info keys that are missing, mistyped, invalid, or unequal

Title and Subject are written to the x-default language alternative while other languages remain intact; Author is written as a one-item ordered sequence; scalar properties retain unrelated namespaces and properties

Valid Info dates with timezones are serialized as canonical UTC XMP dates; malformed Info dates raise EPdfXmpError instead of writing misleading metadata

The operation requires an existing XMP packet and raises EPdfError when none exists; use SaveAsPdfA when complete PDF/A identification and metadata must be created

File output uses atomic replacement and both overloads follow the same signed-document policy as SaveAsWithXmpPacket

Example

var Report: TPdfAMetadataReport;
Report := Pdf1.InspectPdfAMetadata;
if not Report.IsEquivalent then
  Pdf1.NormalizePdfAMetadata('C:\Output\normalized.pdf');

See Also

InspectPdfAMetadata, ValidatePdfA, SaveAsWithXmpPacket, FPdfXmp