function ReadXmpPacket: TPdfXmpPacket;
| Result | TPdfXmpPacket. Parsed packet the caller owns and must free. Namespaces and properties are empty when the document carries no XMP |
XMP is the RDF/XML metadata stream a PDF carries alongside the document information dictionary; PDF/A, PDF/X, PDF/UA, and PDF/VT all record their conformance claims there. The returned object exposes namespaces and properties rather than raw XML, with TryGetSimpleValue, SetSimpleValue, SetArrayValues, and SetLanguageAlternative for editing
The packet is read from the original file bytes when they are available, and otherwise from a fresh serialisation of the live document, so it reflects the document as it currently stands. During progressive loading, where neither source is complete, the call raises EPdfError instead of returning half a packet
Write an edited packet back with SaveAsWithXmpPacket. The document information dictionary is separate and is reached through Metadata and MetaText
var Packet: TPdfXmpPacket;
var Value: TPdfXmpString;
Packet := Pdf.ReadXmpPacket;
try
if Packet.TryGetSimpleValue('http://purl.org/dc/elements/1.1/',
'title', Value) then
ShowMessage(Value);
finally
Packet.Free;
end;