Paper Office
paper-docxAPI referenceopc.pkgreader

PackageReader

paper-docx 0.2.0 API reference

Provides access to the contents of a zip-format OPC package via its :attr:serialized_parts and :attr:pkg_srels attributes.

PackageReader(content_types, pkg_srels, sparts)

Functions

from_file

funcfrom_file(pkg_file)

A PackageReader loaded from pkg_file, with the package graph already validated.

This is the read path behind Document(), so a malformed file is caught here rather than carried into the object model. Raises MalformedPackageError for a corrupt or ambiguous archive, a relationship targeting a missing part, a part with no declared content type, or a content type that contradicts its relationship.

parampkg_file

iter_sparts

funciter_sparts()

Generate a 4-tuple (partname, content_type, reltype, blob) for each of the serialized parts in the package.

iter_srels

funciter_srels()

Generate a 2-tuple (source_uri, srel) for each of the relationships in the package.

On this page