Exceptions

exception pikepdf.exceptions.PdfError

General pikepdf-specific exception.

exception pikepdf.exceptions.PasswordError

Exception thrown when the supplied password is incorrect.

exception pikepdf.exceptions.ForeignObjectError

When a complex object is copied into a foreign PDF without proper methods.

Use Pdf.copy_foreign().

exception pikepdf.exceptions.OutlineStructureError

Indicates an error in the outline data structure.

exception pikepdf.exceptions.UnsupportedImageTypeError

This image is formatted in a way pikepdf does not supported.

exception pikepdf.exceptions.HifiPrintImageNotTranscodableError

Image contains high fidelity printing information and cannot be extracted.

exception pikepdf.exceptions.InvalidPdfImageError

This image is not valid according to the PDF 1.7 specification.

exception pikepdf.exceptions.DataDecodingError

Exception thrown when a stream object in a PDF cannot be decoded.

exception pikepdf.exceptions.DeletedObjectError

When a required object is accessed after deletion.

Thrown when accessing a Object that relies on a Pdf that was deleted using the Python delete statement or collected by the Python garbage collector. To resolve this error, you must retain a reference to the Pdf for the whole time you may be accessing it.

Added in version 7.0.

exception pikepdf.exceptions.DependencyError

A third party dependency is needed to extract streams of this type.

exception pikepdf.exceptions.PdfParsingError(message=None, line=None)

Error when parsing a PDF content stream.

exception pikepdf.exceptions.JobUsageError

Exception thrown when the pikepdf.Job interface is used incorrectly.

exception pikepdf.exceptions.ImageDecompressionError

Image decompression error.

exception pikepdf.DecompressionBombError

Bases: PIL.Image.DecompressionBombError

Raised by image extraction when an image’s pixel count exceeds twice pikepdf.PdfImage.MAX_IMAGE_PIXELS, indicating a possible decompression-bomb (memory exhaustion) attack. Subclasses Pillow’s exception of the same name, so handlers written for Pillow also catch it.

This class is created lazily on first access so that importing pikepdf does not import Pillow.

exception pikepdf.DecompressionBombWarning

Bases: PIL.Image.DecompressionBombWarning

Emitted by image extraction when an image’s pixel count exceeds pikepdf.PdfImage.MAX_IMAGE_PIXELS (but is not large enough to raise pikepdf.DecompressionBombError). Subclasses Pillow’s warning of the same name.