Provides access to PDF document metadata properties including standard document information dictionary fields and XMP metadata.

This class allows reading and writing of standard PDF metadata fields such as title, author, subject, and keywords, as well as custom metadata properties. All changes to metadata properties are immediately applied to the underlying PDF document.

from nutrient import PdfMetadata

Methods

get_custom_pdf_information

def get_custom_pdf_information(self, key: str) -> str

Gets the value of a custom metadata property from the document information dictionary.

Parameters:

NameTypeDescription
keystrThe name of the custom property to retrieve.

Returns: str - The value of the custom property as a string. Returns an empty string if the property does not exist.


set_author

def set_author(self, value: str) -> None

Sets the name of the person that created the document.

Parameters:

NameTypeDescription
valuestrThe value to set for the Author property.

set_creator

def set_creator(self, value: str) -> None

Sets the name of the application that created the original document.

Parameters:

NameTypeDescription
valuestrThe value to set for the Creator property.

set_custom_pdf_information

def set_custom_pdf_information(self, key: str, value: str) -> None

Sets the value of a custom metadata property in the document information dictionary.

Parameters:

NameTypeDescription
keystrThe name of the custom property to set.
valuestrThe value to assign to the custom property.

set_keywords

def set_keywords(self, value: str) -> None

Sets the keywords associated with the document.

Parameters:

NameTypeDescription
valuestrThe value to set for the Keywords property.

set_producer

def set_producer(self, value: str) -> None

Sets the name of the application that converted the document to PDF.

Parameters:

NameTypeDescription
valuestrThe value to set for the Producer property.

set_subject

def set_subject(self, value: str) -> None

Sets the subject of the document.

Parameters:

NameTypeDescription
valuestrThe value to set for the Subject property.

set_title

def set_title(self, value: str) -> None

Sets the title of the document.

Parameters:

NameTypeDescription
valuestrThe value to set for the Title property.

set_xmp

def set_xmp(self, value: str) -> None

Sets the XMP metadata stream of the document.

Parameters:

NameTypeDescription
valuestrThe value to set for the XMP property.

Properties

author

@property
def author(self) -> str

Gets the name of the person that created the document.

Type: str

Read-only property.


creation_date

@property
def creation_date(self) -> str

Gets the date and time the document was created.

Type: str

Read-only property.


creator

@property
def creator(self) -> str

Gets the name of the application that created the original document.

Type: str

Read-only property.


keywords

@property
def keywords(self) -> str

Gets the keywords associated with the document.

Type: str

Read-only property.


modification_date

@property
def modification_date(self) -> str

Gets the date and time the document was most recently modified.

Type: str

Read-only property.


producer

@property
def producer(self) -> str

Gets the name of the application that converted the document to PDF.

Type: str

Read-only property.


subject

@property
def subject(self) -> str

Gets the subject of the document.

Type: str

Read-only property.


title

@property
def title(self) -> str

Gets the title of the document.

Type: str

Read-only property.


xmp

@property
def xmp(self) -> str

Gets the XMP metadata stream of the document.

Type: str

Read-only property.