PDFium Delphi Component Docs

SaveAsWithXmpPacket method

Component: TPdf  ·  Unit: PDFium
Save the document with a replacement XMP metadata packet

Syntax

function SaveAsWithXmpPacket(Stream: TStream; Packet: TPdfXmpPacket; AllowSignedDocument: Boolean = False): Boolean;

StreamTStream. Destination stream
PacketTPdfXmpPacket. Packet to write, normally obtained from ReadXmpPacket and edited. The caller keeps ownership
AllowSignedDocumentBoolean. Pass True to permit rewriting a signed document. Defaults to False
ResultBoolean. True when the document was written

 

function SaveAsWithXmpPacket(const FileName: string; Packet: TPdfXmpPacket; AllowSignedDocument: Boolean = False): Boolean;

FileNamestring. Destination file, written atomically through a temporary file in the same directory
PacketTPdfXmpPacket. Packet to write
AllowSignedDocumentBoolean. Permit rewriting a signed document
ResultBoolean. True when the file was written

Description

Replaces the document metadata stream with the serialised packet as the file is written, which keeps metadata edits and document edits in one save rather than a second rewriting pass

Rewriting a signed document invalidates its signatures, so that case is refused unless the caller opts in explicitly

Conformance profiles read their claims from XMP, so a packet edited here is what tools such as ValidatePdfA will see afterwards

See Also

ReadXmpPacket, SaveAs, SaveAsPdfA, ValidatePdfA