Metadata class

Metadata class

Provides the main class to access metadata in all supported formats.

The Metadata type exposes the following members:

Constructors

Constructor Description
__init__(self, file_path) Initializes a new instance of the Metadata class.
__init__(self, document) Initializes a new instance of the Metadata class.
__init__(self, file_path, load_options) Initializes a new instance of the Metadata class.
__init__(self, document, load_options) Initializes a new instance of the Metadata class.
__init__(self, uri) Initializes a new instance of the Metadata class.
__init__(self, uri, load_options) Initializes a new instance of the Metadata class.

Properties

Property Description
file_format Gets the type of the loaded file (if recognized).

Methods

Method Description
save(self) Saves all changes made in the loaded document.
save(self, document) Saves the document content into a stream.
save(self, file_path) Saves the document content to the specified file.
copy_to(self, metadata) Copy known metadata properties from source package to destination package.
The operation is recursive so it affects all nested packages as well.
If an existing property its value is updated.
If there is a known property missing in a destination package it is added to the package.
If there is a known property missing in a source package it is not remove from destination package. If that need, use Sanitize method before.
copy_to(self, metadata, tags)
get_root_package(self) Gets the root package providing access to all metadata properties extracted from the file.
find_properties(self, specification) Finds the metadata properties satisfying a specification.
The search is recursive so it affects all nested packages as well.
update_properties(self, specification, value) Updates known metadata properties satisfying a specification.
The operation is recursive so it affects all nested packages as well.
remove_properties(self, specification) Removes metadata properties satisfying a specification.
add_properties(self, specification, value) Adds known metadata properties satisfying the specification.
The operation is recursive so it affects all nested packages as well.
set_properties(self, specification, value) Sets known metadata properties satisfying the specification.
The operation is recursive so it affects all nested packages as well.
This method is a combination of Metadata.add_properties and Metadata.update_properties.
If an existing property satisfies the specification its value is updated.
If there is a known property missing in the package that satisfies the specification it is added to the package.
sanitize(self) Removes writable metadata properties from all detected packages or whole packages if possible.
The operation is recursive so it affects all nested packages as well.
generate_preview(self, preview_options) Creates preview images for specified pages.
get_document_info(self) Gets common information about the loaded document.

See Also