XMP Reference

class pdfnaut.objects.xmp.XMPDateProperty[source]

Bases: XMPProperty

An XMP Date property – an ISO 8601 date string, or specifically, the subset specified in https://www.w3.org/TR/NOTE-datetime.

See https://developer.adobe.com/xmp/docs/XMPNamespaces/XMPDataTypes/#date.

class pdfnaut.objects.xmp.XMPLangAltProperty[source]

Bases: XMPProperty

An XMP Language Alternative property – an alternative array of simple text items facilitating the selection of a text item based on a desired language.

In this case, this array is represented as a mapping of language names to text items corresponding to each language. The language name should be a value as defined in RFC 3066, composed of a primary language subtag and an optional series of subsequent subtags.

The default value, if known, should be the first item in the dictionary. A default value may also be explicitly marked by setting its language to ‘x-default’.

See https://developer.adobe.com/xmp/docs/XMPNamespaces/XMPDataTypes/#language-alternative.

class pdfnaut.objects.xmp.XMPListProperty[source]

Bases: XMPProperty

An array valued XMP property – in this context, either an RDF sequence, used for ordered arrays, or an RDF bag, used for unordered arrays.

See § 7.7 “Array valued XMP properties” in Part 1 of the XMP specification.

class pdfnaut.objects.xmp.XMPProperty[source]

Bases: object

An XMP property included in an XMP packet.

__init__(namespace_uri: str, local_name: str, **extra: Any) None[source]
extra

Any additional property-specific values.

local_name

The local name of this property.

namespace_uri

The namespace URI of this property.

class pdfnaut.objects.xmp.XMPTextProperty[source]

Bases: XMPProperty

An XMP Text property – a possibly empty Unicode string.

class pdfnaut.objects.xmp.XmpMetadata[source]

Bases: object

An object representing Extensible Metadata Platform (XMP) metadata, either pertaining to an entire document or to a particular resource.

For information about XMP, see https://developer.adobe.com/xmp/docs/.

Parameters:

stream (PdfStream, optional) – The XMP packet to parse as a PDF stream. If stream is None, a new stream containing a packet will be created.

Raises:

PdfParseError – If stream does not contain a valid XMP packet.

__init__(stream: PdfStream | None = None) None[source]
dc_creator

The entities primarily responsible for creating this resource.

dc_description

Textual descriptions of this resource as a mapping of language names to items.

dc_format

The MIME type of this resource.

dc_rights

Rights statements pertaining to this resource.

dc_subject

The topics or descriptions specifying the content of this resource.

dc_title

The titles or names given to this resource as a mapping of language names to titles.

packet

The XMP packet as an XML document.

pdf_keywords

Keywords associated with the document.

pdf_pdfversion

The PDF file version. For example, ‘1.0’ or ‘1.3’.

pdf_producer

The name of the tool that produced this PDF document.

pdf_trapped

Whether the document has been modified to include trapping information (see § 14.11.6, “Trapping support”).

rdf_root

The RDF root of the packet being parsed.

stream: PdfStream

The XMP packet as a string.

xmp_create_date

The datetime this resource was created. This need not match the file system creation date.

xmp_creator_tool

The name of the first known tool that created this resource.

xmp_metadata_date

The datetime this metadata was last modified. It should be the same or more recent than modify_date.

xmp_modify_date

The datetime this resource was last modified.

pdfnaut.objects.xmp.get_full_text(element: Element) str[source]

Returns the full text content within element.

pdfnaut.objects.xmp.lookup_prefix_for_ns(node: Node, namespace: str) tuple[str, Node] | None[source]

Locates a namespace prefix matching the namespace URI in node. Returns either a tuple of two items containing, in order, the prefix of the namespace URI and the node where it was found, or None, if no prefix is registered for the namespace URI.

This is an implementation of https://dom.spec.whatwg.org/#locate-a-namespace-prefix.