pypdf API Reference
Full documentation for pypdf (6.14.2)
pypdf.DocumentInformation
Python Library Documentation: class DocumentInformation in module pypdf._doc_common
class DocumentInformation(pypdf.generic._data_structures.DictionaryObject)
| DocumentInformation() -> None
|
| A class representing the basic document metadata provided in a PDF File.
| This class is accessible through
| :py:class:`PdfReader.metadata<pypdf.PdfReader.metadata>`.
|
| All text properties of the document metadata have
| *two* properties, e.g. author and author_raw. The non-raw property will
| always return a ``TextStringObject``, making it ideal for a case where the
| metadata is being displayed. The raw property can sometimes return a
| ``ByteStringObject``, if pypdf was unable to decode the string's text
| encoding; this requires additional safety in the caller and therefore is not
| as commonly accessed.
|
| Method resolution order:
| DocumentInformation
| pypdf.generic._data_structures.DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| author
| Read-only property accessing the document's author.
|
| Returns a ``TextStringObject`` or ``None`` if the author is not
| specified.
|
| author_raw
| The "raw" version of author; can return a ``ByteStringObject``.
|
| creation_date
| Read-only property accessing the document's creation date.
|
| creation_date_raw
| The "raw" version of creation date; can return a ``ByteStringObject``.
|
| Typically in the format ``D:YYYYMMDDhhmmss[+Z-]hh'mm`` where the suffix
| is the offset from UTC.
|
| creator
| Read-only property accessing the document's creator.
|
| If the document was converted to PDF from another format, this is the
| name of the application (e.g. OpenOffice) that created the original
| document from which it was converted. Returns a ``TextStringObject`` or
| ``None`` if the creator is not specified.
|
| creator_raw
| The "raw" version of creator; can return a ``ByteStringObject``.
|
| keywords
| Read-only property accessing the document's keywords.
|
| Returns a ``TextStringObject`` or ``None`` if keywords are not
| specified.
|
| keywords_raw
| The "raw" version of keywords; can return a ``ByteStringObject``.
|
| modification_date
| Read-only property accessing the document's modification date.
|
| The date and time the document was most recently modified.
|
| modification_date_raw
| The "raw" version of modification date; can return a
| ``ByteStringObject``.
|
| Typically in the format ``D:YYYYMMDDhhmmss[+Z-]hh'mm`` where the suffix
| is the offset from UTC.
|
| producer
| Read-only property accessing the document's producer.
|
| If the document was converted to PDF from another format, this is the
| name of the application (for example, macOS Quartz) that converted it to
| PDF. Returns a ``TextStringObject`` or ``None`` if the producer is not
| specified.
|
| producer_raw
| The "raw" version of producer; can return a ``ByteStringObject``.
|
| subject
| Read-only property accessing the document's subject.
|
| Returns a ``TextStringObject`` or ``None`` if the subject is not
| specified.
|
| subject_raw
| The "raw" version of subject; can return a ``ByteStringObject``.
|
| title
| Read-only property accessing the document's title.
|
| Returns a ``TextStringObject`` or ``None`` if the title is not
| specified.
|
| title_raw
| The "raw" version of title; can return a ``ByteStringObject``.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf.generic._data_structures.DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
pypdf.ImageType
Python Library Documentation: class ImageType in module pypdf.constants class ImageType(enum.IntFlag) | ImageType(*values) | | Method resolution order: | ImageType | enum.IntFlag | builtins.int | enum.ReprEnum | enum.Flag | enum.Enum | builtins.object | | Methods defined here: | | __and__(self, other) from enum.Flag | | __format__(self, format_spec, /) from builtins.int | Convert to a string according to format_spec. | | __invert__(self) from enum.Flag | | __new__(cls, value) from enum.Enum | Create and return a new object. See help(type) for accurate signature. | | __or__(self, other) from enum.Flag | Return self|value. | | __rand__ = __and__(self, other) | | __ror__ = __or__(self, other) | | __rxor__ = __xor__(self, other) | | __xor__(self, other) from enum.Flag | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | DRAWING_IMAGES = <ImageType.DRAWING_IMAGES: 4> | | INLINE_IMAGES = <ImageType.INLINE_IMAGES: 2> | | XOBJECT_IMAGES = <ImageType.XOBJECT_IMAGES: 1> | | ---------------------------------------------------------------------- | Methods inherited from enum.IntFlag: | | __repr__(self) from enum.Flag | Return repr(self). | | __str__ = __repr__(self, /) from builtins.int | Return repr(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number | | ---------------------------------------------------------------------- | Methods inherited from enum.Flag: | | __contains__(self, other) | Returns True if self has at least the same flags set as other. | | __iter__(self) | Returns flags in definition order. | | __len__(self) | Return the number of members (no aliases) | | ---------------------------------------------------------------------- | Methods inherited from enum.Enum: | | __dir__(self) | Returns public methods and other interesting attributes. | | __init__(self, *args, **kwds) | Initialize self. See help(type(self)) for accurate signature. | | __reduce_ex__(self, proto) | Helper for pickle. | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __getitem__(name) | Return the member matching `name`. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping.
pypdf.ObjectDeletionFlag
Python Library Documentation: class ObjectDeletionFlag in module pypdf._writer class ObjectDeletionFlag(enum.IntFlag) | ObjectDeletionFlag(*values) | | Method resolution order: | ObjectDeletionFlag | enum.IntFlag | builtins.int | enum.ReprEnum | enum.Flag | enum.Enum | builtins.object | | Methods defined here: | | __and__(self, other) from enum.Flag | | __format__(self, format_spec, /) from builtins.int | Convert to a string according to format_spec. | | __invert__(self) from enum.Flag | | __new__(cls, value) from enum.Enum | Create and return a new object. See help(type) for accurate signature. | | __or__(self, other) from enum.Flag | Return self|value. | | __rand__ = __and__(self, other) | | __ror__ = __or__(self, other) | | __rxor__ = __xor__(self, other) | | __xor__(self, other) from enum.Flag | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | ALL_ANNOTATIONS = <ObjectDeletionFlag.ALL_ANNOTATIONS: 16> | | ATTACHMENTS = <ObjectDeletionFlag.ATTACHMENTS: 4> | | DRAWING_IMAGES = <ObjectDeletionFlag.DRAWING_IMAGES: 128> | | INLINE_IMAGES = <ObjectDeletionFlag.INLINE_IMAGES: 64> | | LINKS = <ObjectDeletionFlag.LINKS: 2> | | OBJECTS_3D = <ObjectDeletionFlag.OBJECTS_3D: 8> | | TEXT = <ObjectDeletionFlag.TEXT: 1> | | XOBJECT_IMAGES = <ObjectDeletionFlag.XOBJECT_IMAGES: 32> | | ---------------------------------------------------------------------- | Methods inherited from enum.IntFlag: | | __repr__(self) from enum.Flag | Return repr(self). | | __str__ = __repr__(self, /) from builtins.int | Return repr(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number | | ---------------------------------------------------------------------- | Methods inherited from enum.Flag: | | __contains__(self, other) | Returns True if self has at least the same flags set as other. | | __iter__(self) | Returns flags in definition order. | | __len__(self) | Return the number of members (no aliases) | | ---------------------------------------------------------------------- | Methods inherited from enum.Enum: | | __dir__(self) | Returns public methods and other interesting attributes. | | __init__(self, *args, **kwds) | Initialize self. See help(type(self)) for accurate signature. | | __reduce_ex__(self, proto) | Helper for pickle. | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __getitem__(name) | Return the member matching `name`. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping.
pypdf.PIL
Python Library Documentation: package PIL
NAME
PIL - Pillow (Fork of the Python Imaging Library)
DESCRIPTION
Pillow is the friendly PIL fork by Jeffrey 'Alex' Clark and contributors.
https://github.com/python-pillow/Pillow/
Pillow is forked from PIL 1.1.7.
PIL is the Python Imaging Library by Fredrik Lundh and contributors.
Copyright (c) 1999 by Secret Labs AB.
Use PIL.__version__ for this Pillow version.
;-)
PACKAGE CONTENTS
AvifImagePlugin
BdfFontFile
BlpImagePlugin
BmpImagePlugin
BufrStubImagePlugin
ContainerIO
CurImagePlugin
DcxImagePlugin
DdsImagePlugin
EpsImagePlugin
ExifTags
FitsImagePlugin
FliImagePlugin
FontFile
FpxImagePlugin
FtexImagePlugin
GbrImagePlugin
GdImageFile
GifImagePlugin
GimpGradientFile
GimpPaletteFile
GribStubImagePlugin
Hdf5StubImagePlugin
IcnsImagePlugin
IcoImagePlugin
ImImagePlugin
Image
ImageChops
ImageCms
ImageColor
ImageDraw
ImageDraw2
ImageEnhance
ImageFile
ImageFilter
ImageFont
ImageGrab
ImageMath
ImageMode
ImageMorph
ImageOps
ImagePalette
ImagePath
ImageQt
ImageSequence
ImageShow
ImageStat
ImageText
ImageTk
ImageTransform
ImageWin
ImtImagePlugin
IptcImagePlugin
Jpeg2KImagePlugin
JpegImagePlugin
JpegPresets
McIdasImagePlugin
MicImagePlugin
MpegImagePlugin
MpoImagePlugin
MspImagePlugin
PSDraw
PaletteFile
PalmImagePlugin
PcdImagePlugin
PcfFontFile
PcxImagePlugin
PdfImagePlugin
PdfParser
PixarImagePlugin
PngImagePlugin
PpmImagePlugin
PsdImagePlugin
QoiImagePlugin
SgiImagePlugin
SpiderImagePlugin
SunImagePlugin
TarIO
TgaImagePlugin
TiffImagePlugin
TiffTags
WalImageFile
WebPImagePlugin
WmfImagePlugin
XVThumbImagePlugin
XbmImagePlugin
XpmImagePlugin
__main__
_avif
_binary
_deprecate
_imaging
_imagingcms
_imagingft
_imagingmath
_imagingmorph
_imagingtk
_tkinter_finder
_typing
_util
_version
_webp
features
report
CLASSES
builtins.OSError(builtins.Exception)
UnidentifiedImageError
class UnidentifiedImageError(builtins.OSError)
| Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified.
|
| If a PNG image raises this error, setting :data:`.ImageFile.LOAD_TRUNCATED_IMAGES`
| to true may allow the image to be opened after all. The setting will ignore missing
| data and checksum failures.
|
| Method resolution order:
| UnidentifiedImageError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
VERSION
12.3.0
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pil\__init__.py
pypdf.PageObject
Python Library Documentation: class PageObject in module pypdf._page
class PageObject(pypdf.generic._data_structures.DictionaryObject)
| PageObject(pdf: Optional[pypdf._protocols.PdfCommonDocProtocol] = None, indirect_reference: Optional[pypdf.generic._base.IndirectObject] = None) -> None
|
| PageObject represents a single page within a PDF file.
|
| Typically these objects will be created by accessing the
| :attr:`pages<pypdf.PdfReader.pages>` property of the
| :class:`PdfReader<pypdf.PdfReader>` class, but it is
| also possible to create an empty page with the
| :meth:`create_blank_page()<pypdf._page.PageObject.create_blank_page>` static method.
|
| Args:
| pdf: PDF file the page belongs to.
| indirect_reference: Stores the original indirect reference to
| this object in its source PDF
|
| Method resolution order:
| PageObject
| pypdf.generic._data_structures.DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, pdf: Optional[pypdf._protocols.PdfCommonDocProtocol] = None, indirect_reference: Optional[pypdf.generic._base.IndirectObject] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| add_transformation(self, ctm: Union[pypdf._page.Transformation, tuple[float, float, float, float, float, float]], expand: bool = False) -> None
| Apply a transformation matrix to the page.
|
| Args:
| ctm: A 6-element tuple containing the operands of the
| transformation matrix. Alternatively, a
| :py:class:`Transformation<pypdf.Transformation>`
| object can be passed.
|
| See :doc:`/user/cropping-and-transforming`.
|
| compress_content_streams(self, level: int = -1) -> None
| Compress the size of this page by joining all content streams and
| applying a FlateDecode filter.
|
| However, it is possible that this function will perform no action if
| content stream compression becomes "automatic".
|
| extract_text(self, *args: Any, orientations: Union[int, tuple[int, ...]] = (0, 90, 180, 270), space_width: float = 200.0, visitor_operand_before: Optional[Callable[[Any, Any, Any, Any], NoneType]] = None, visitor_operand_after: Optional[Callable[[Any, Any, Any, Any], NoneType]] = None, visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], NoneType]] = None, extraction_mode: Literal['plain', 'layout'] = 'plain', **kwargs: Any) -> str
| Locate all text drawing commands, in the order they are provided in the
| content stream, and extract the text.
|
| This works well for some PDF files, but poorly for others, depending on
| the generator used. This will be refined in the future.
|
| Do not rely on the order of text coming out of this function, as it
| will change if this function is made more sophisticated.
|
| Arabic and Hebrew are extracted in the correct order.
| If required a custom RTL range of characters can be defined;
| see function set_custom_rtl.
|
| Additionally you can provide visitor methods to get informed on all
| operations and all text objects.
| For example in some PDF files this can be useful to parse tables.
|
| Args:
| orientations: list of orientations extract_text will look for
| default = (0, 90, 180, 270)
| note: currently only 0 (up),90 (turned left), 180 (upside down),
| 270 (turned right)
| Silently ignored in "layout" mode.
| space_width: force default space width
| if not extracted from font (default: 200)
| Silently ignored in "layout" mode.
| visitor_operand_before: function to be called before processing an operation.
| It has four arguments: operator, operand-arguments,
| current transformation matrix and text matrix.
| Ignored with a warning in "layout" mode.
| visitor_operand_after: function to be called after processing an operation.
| It has four arguments: operator, operand-arguments,
| current transformation matrix and text matrix.
| Ignored with a warning in "layout" mode.
| visitor_text: function to be called when extracting some text at some position.
| It has five arguments: text, current transformation matrix,
| text matrix, font-dictionary and font-size.
| The font-dictionary may be None in case of unknown fonts.
| If not None it may e.g. contain key "/BaseFont" with value "/Arial,Bold".
| Ignored with a warning in "layout" mode.
| extraction_mode (Literal["plain", "layout"]): "plain" for legacy functionality,
| "layout" for experimental layout mode functionality.
| NOTE: orientations, space_width, and visitor_* parameters are NOT respected
| in "layout" mode.
|
| kwargs:
| layout_mode_space_vertically (bool): include blank lines inferred from
| y distance + font height. Defaults to True.
| layout_mode_scale_weight (float): multiplier for string length when calculating
| weighted average character width. Defaults to 1.25.
| layout_mode_strip_rotated (bool): layout mode does not support rotated text.
| Set to False to include rotated text anyway. If rotated text is discovered,
| layout will be degraded and a warning will result. Defaults to True.
| layout_mode_debug_path (Path | None): if supplied, must target a directory.
| creates the following files with debug information for layout mode
| functions if supplied:
|
| - fonts.json: output of self._layout_mode_fonts
| - tjs.json: individual text render ops with corresponding transform matrices
| - bts.json: text render ops left justified and grouped by BT/ET operators
| - bt_groups.json: BT/ET operations grouped by rendered y-coord (aka lines)
| layout_mode_font_height_weight (float): multiplier for font height when calculating
| blank lines. Defaults to 1.
|
| Returns:
| The extracted text
|
| extract_xform_text(self, xform: pypdf.generic._data_structures.EncodedStreamObject, orientations: tuple[int, ...] = (0, 90, 270, 360), space_width: float = 200.0, visitor_operand_before: Optional[Callable[[Any, Any, Any, Any], NoneType]] = None, visitor_operand_after: Optional[Callable[[Any, Any, Any, Any], NoneType]] = None, visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], NoneType]] = None, *, known_ids: Optional[set[int]] = None) -> str
| Extract text from an XObject.
|
| Args:
| xform:
| orientations:
| space_width: force default space width (if not extracted from font (default 200)
| visitor_operand_before:
| visitor_operand_after:
| visitor_text:
|
| Returns:
| The extracted text
|
| get_contents(self) -> Optional[pypdf.generic._data_structures.ContentStream]
| Access the page contents.
|
| Returns:
| The ``/Contents`` object, or ``None`` if it does not exist.
| ``/Contents`` is optional, as described in §7.7.3.3 of the PDF Reference.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Note: this function is overloaded to return the same results
| as a DictionaryObject.
|
| Returns:
| Hash considering type and value.
|
| hash_value_data(self) -> bytes
|
| merge_page(self, page2: 'PageObject', expand: bool = False, over: bool = True) -> None
| Merge the content streams of two pages into one.
|
| Resource references (e.g. fonts) are maintained from both pages.
| The mediabox, cropbox, etc of this page are not altered.
| The parameter page's content stream will
| be added to the end of this page's content stream,
| meaning that it will be drawn after, or "on top" of this page.
|
| Args:
| page2: The page to be merged into this one. Should be
| an instance of :class:`PageObject<PageObject>`.
| over: set the page2 content over page1 if True (default) else under
| expand: If True, the current page dimensions will be
| expanded to accommodate the dimensions of the page to be merged.
|
| merge_rotated_page(self, page2: 'PageObject', rotation: float, over: bool = True, expand: bool = False) -> None
| Similar to :meth:`~pypdf._page.PageObject.merge_page`, but the stream to be merged
| is rotated by applying a transformation matrix.
|
| Args:
| page2: The page to be merged into this one.
| rotation: The angle of the rotation, in degrees
| over: set the page2 content over page1 if True (default) else under
| expand: Whether the page should be expanded to fit the
| dimensions of the page to be merged.
|
| merge_scaled_page(self, page2: 'PageObject', scale: float, over: bool = True, expand: bool = False) -> None
| Similar to :meth:`~pypdf._page.PageObject.merge_page`, but the stream to be merged
| is scaled by applying a transformation matrix.
|
| Args:
| page2: The page to be merged into this one.
| scale: The scaling factor
| over: set the page2 content over page1 if True (default) else under
| expand: Whether the page should be expanded to fit the
| dimensions of the page to be merged.
|
| merge_transformed_page(self, page2: 'PageObject', ctm: Union[tuple[float, float, float, float, float, float], pypdf._page.Transformation], over: bool = True, expand: bool = False) -> None
| Similar to :meth:`~pypdf._page.PageObject.merge_page`, but a transformation
| matrix is applied to the merged stream.
|
| Args:
| page2: The page to be merged into this one.
| ctm: a 6-element tuple containing the operands of the
| transformation matrix
| over: set the page2 content over page1 if True (default) else under
| expand: Whether the page should be expanded to fit the dimensions
| of the page to be merged.
|
| merge_translated_page(self, page2: 'PageObject', tx: float, ty: float, over: bool = True, expand: bool = False) -> None
| Similar to :meth:`~pypdf._page.PageObject.merge_page`, but the stream to be
| merged is translated by applying a transformation matrix.
|
| Args:
| page2: the page to be merged into this one.
| tx: The translation on X axis
| ty: The translation on Y axis
| over: set the page2 content over page1 if True (default) else under
| expand: Whether the page should be expanded to fit the
| dimensions of the page to be merged.
|
| replace_contents(self, content: Union[NoneType, pypdf.generic._data_structures.ContentStream, pypdf.generic._data_structures.EncodedStreamObject, pypdf.generic._data_structures.ArrayObject]) -> None
| Replace the page contents with the new content and nullify old objects
| Args:
| content: new content; if None delete the content field.
|
| rotate(self, angle: int) -> 'PageObject'
| Rotate a page clockwise by increments of 90 degrees.
|
| Args:
| angle: Angle to rotate the page. Must be an increment of 90 deg.
|
| Returns:
| The rotated PageObject
|
| scale(self, sx: float, sy: float) -> None
| Scale a page by the given factors by applying a transformation matrix
| to its content and updating the page size.
|
| This updates the various page boundaries (bleedbox, trimbox, etc.)
| and the contents of the page.
|
| Args:
| sx: The scaling factor on horizontal axis.
| sy: The scaling factor on vertical axis.
|
| scale_by(self, factor: float) -> None
| Scale a page by the given factor by applying a transformation matrix to
| its content and updating the page size.
|
| Args:
| factor: The scaling factor (for both X and Y axis).
|
| scale_to(self, width: float, height: float) -> None
| Scale a page to the specified dimensions by applying a transformation
| matrix to its content and updating the page size.
|
| Args:
| width: The new width.
| height: The new height.
|
| transfer_rotation_to_content(self) -> None
| Apply the rotation of the page to the content and the media/crop/...
| boxes.
|
| It is recommended to apply this function before page merging.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| create_blank_page(pdf: Optional[pypdf._protocols.PdfCommonDocProtocol] = None, width: Union[float, decimal.Decimal, NoneType] = None, height: Union[float, decimal.Decimal, NoneType] = None) -> 'PageObject'
| Return a new blank page.
|
| If ``width`` or ``height`` is ``None``, try to get the page size
| from the last page of *pdf*.
|
| Args:
| pdf: PDF file the page is within.
| width: The width of the new page expressed in default user
| space units.
| height: The height of the new page expressed in default user
| space units.
|
| Returns:
| The new blank page
|
| Raises:
| PageSizeNotDefinedError: if ``pdf`` is ``None`` or contains
| no page
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| images
| Read-only property emulating a list of images on a page.
|
| Get a list of all images on the page. The key can be:
| - A string (for the top object)
| - A tuple (for images within XObject forms)
| - An integer
|
| Examples:
| * `reader.pages[0].images[0]` # return first image
| * `reader.pages[0].images['/I0']` # return image '/I0'
| * `reader.pages[0].images['/TP1','/Image1']` # return image '/Image1' within '/TP1' XObject form
| * `for img in reader.pages[0].images:` # loops through all objects
|
| Example usage:
|
| >>> from pypdf import PdfWriter
| >>> writer = PdfWriter()
| >>> page = writer.add_blank_page(800, 600)
| >>> images = page.images
|
| page_number
| Read-only property which returns the page number within the PDF file.
|
| Returns:
| Page number; None if the page is not attached to a PDF.
|
| user_unit
| A read-only positive number giving the size of user space units.
|
| It is in multiples of 1/72 inch. Hence a value of 1 means a user
| space unit is 1/72 inch, and a value of 3 means that a user
| space unit is 3/72 inch.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| annotations
|
| artbox
|
| bleedbox
|
| cropbox
|
| inline_images
| Return only inline images from the page.
|
| .. deprecated::
| Use :attr:`images` and filter by :attr:`ImageFile.is_inline` instead.
| This property will be removed in pypdf 7.0.
|
| Examples:
| >>> from pypdf import PdfWriter
| >>> writer = PdfWriter()
| >>> page = writer.add_blank_page(800,600)
| >>> for image_name, image_file in page.images.items():
| ... if image_file.is_inline:
| ... print(f"{image_name} is inline")
|
| mediabox
|
| rotation
| The visual rotation of the page.
|
| This number has to be a multiple of 90 degrees: 0, 90, 180, or 270 are
| valid values. This property does not affect ``/Contents``.
|
| trimbox
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'original_page': 'PageObject'}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf.generic._data_structures.DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
pypdf.PageRange
Python Library Documentation: class PageRange in module pypdf.pagerange
class PageRange(builtins.object)
| PageRange(arg: Union[slice, ForwardRef('PageRange'), str]) -> None
|
| A slice-like representation of a range of page indices.
|
| For example, page numbers, only starting at zero.
|
| The syntax is like what you would put between brackets [ ].
| The slice is one of the few Python types that can't be subclassed,
| but this class converts to and from slices, and allows similar use.
|
| - PageRange(str) parses a string representing a page range.
| - PageRange(slice) directly "imports" a slice.
| - to_slice() gives the equivalent slice.
| - str() and repr() allow printing.
| - indices(n) is like slice.indices(n).
|
| Methods defined here:
|
| __add__(self, other: 'PageRange') -> 'PageRange'
|
| __eq__(self, other: object) -> bool
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __init__(self, arg: Union[slice, ForwardRef('PageRange'), str]) -> None
| Initialize with either a slice -- giving the equivalent page range,
| or a PageRange object -- making a copy,
| or a string like
| "int", "[int]:[int]" or "[int]:[int]:[int]",
| where the brackets indicate optional ints.
| Remember, page indices start with zero.
| Page range expression examples:
|
| : all pages. -1 last page.
| 22 just the 23rd page. :-1 all but the last page.
| 0:3 the first three pages. -2 second-to-last page.
| :3 the first three pages. -2: last two pages.
| 5: from the sixth page onward. -3:-1 third & second to last.
| The third, "stride" or "step" number is also recognized.
| ::2 0 2 4 ... to the end. 3:0:-1 3 2 1 but not 0.
| 1:10:2 1 3 5 7 9 2::-1 2 1 0.
| ::-1 all pages in reverse order.
| Note the difference between this notation and arguments to slice():
| slice(3) means the first three pages;
| PageRange("3") means the range of only the fourth page.
| However PageRange(slice(3)) means the first three pages.
|
| __repr__(self) -> str
| A string like "PageRange('1:2:3')".
|
| __str__(self) -> str
| A string like "1:2:3".
|
| indices(self, n: int) -> tuple[int, int, int]
| Assuming a sequence of length n, calculate the start and stop indices,
| and the stride length of the PageRange.
|
| See help(slice.indices).
|
| Args:
| n: the length of the list of pages to choose from.
|
| Returns:
| Arguments for range().
|
| to_slice(self) -> slice
| Return the slice equivalent of this page range.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| valid(input: Any) -> bool
| True if input is a valid initializer for a PageRange.
|
| Args:
| input: A possible PageRange string or a PageRange object.
|
| Returns:
| True, if the ``input`` is a valid PageRange.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
pypdf.PaperSize
Python Library Documentation: class PaperSize in module pypdf.papersizes class PaperSize(builtins.object) | (width, height) of the paper in portrait mode in pixels at 72 ppi. | | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | A0 = Dimensions(width=2384, height=3370) | | A1 = Dimensions(width=1684, height=2384) | | A2 = Dimensions(width=1191, height=1684) | | A3 = Dimensions(width=842, height=1191) | | A4 = Dimensions(width=595, height=842) | | A5 = Dimensions(width=420, height=595) | | A6 = Dimensions(width=298, height=420) | | A7 = Dimensions(width=210, height=298) | | A8 = Dimensions(width=147, height=210) | | C4 = Dimensions(width=649, height=918)
pypdf.PasswordType
Python Library Documentation: class PasswordType in module pypdf._encryption class PasswordType(enum.IntEnum) | PasswordType(*values) | | Method resolution order: | PasswordType | enum.IntEnum | builtins.int | enum.ReprEnum | enum.Enum | builtins.object | | Methods defined here: | | __format__(self, format_spec, /) from builtins.int | Convert to a string according to format_spec. | | __new__(cls, value) from enum.Enum | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | NOT_DECRYPTED = <PasswordType.NOT_DECRYPTED: 0> | | OWNER_PASSWORD = <PasswordType.OWNER_PASSWORD: 2> | | USER_PASSWORD = <PasswordType.USER_PASSWORD: 1> | | ---------------------------------------------------------------------- | Methods inherited from enum.IntEnum: | | __repr__(self) from enum.Enum | Return repr(self). | | __str__ = __repr__(self, /) from builtins.int | Return repr(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __and__(self, value, /) | Return self&value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __invert__(self, /) | ~self | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __or__(self, value, /) | Return self|value. | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rand__(self, value, /) | Return value&self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __ror__(self, value, /) | Return value|self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __rxor__(self, value, /) | Return value^self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | __xor__(self, value, /) | Return self^value. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number | | ---------------------------------------------------------------------- | Methods inherited from enum.Enum: | | __dir__(self) | Returns public methods and other interesting attributes. | | __init__(self, *args, **kwds) | Initialize self. See help(type(self)) for accurate signature. | | __reduce_ex__(self, proto) | Helper for pickle. | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __contains__(value) | Return True if `value` is in `cls`. | | `value` is in `cls` if: | 1) `value` is a member of `cls`, or | 2) `value` is the value of one of the `cls`'s members. | | __getitem__(name) | Return the member matching `name`. | | __iter__() | Return members in definition order. | | __len__() | Return the number of members (no aliases) | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping.
pypdf.PdfReader
Python Library Documentation: class PdfReader in module pypdf._reader
class PdfReader(pypdf._doc_common.PdfDocCommon)
| PdfReader(stream: Union[str, IO[Any], pathlib.Path], strict: bool = False, password: Union[NoneType, str, bytes] = None, *, root_object_recovery_limit: Optional[int] = 10000) -> None
|
| Initialize a PdfReader object.
|
| This operation can take some time, as the PDF stream's cross-reference
| tables are read into memory.
|
| Args:
| stream: A File object or an object that supports the standard read
| and seek methods similar to a File object. Could also be a
| string representing a path to a PDF file.
| strict: Determines whether user should be warned of all
| problems and also causes some correctable problems to be fatal.
| Defaults to ``False``.
| password: Decrypt PDF file at initialization. If the
| password is None, the file will not be decrypted.
| Defaults to ``None``.
| root_object_recovery_limit: The maximum number of objects to query
| for recovering the Root object in non-strict mode. To disable
| this security measure, pass ``None``.
|
| Method resolution order:
| PdfReader
| pypdf._doc_common.PdfDocCommon
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self) -> Self
|
| __exit__(self, exc_type: Optional[type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[traceback]) -> None
|
| __init__(self, stream: Union[str, IO[Any], pathlib.Path], strict: bool = False, password: Union[NoneType, str, bytes] = None, *, root_object_recovery_limit: Optional[int] = 10000) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| add_form_topname(self, name: str) -> Optional[pypdf.generic._data_structures.DictionaryObject]
| Add a top level form that groups all form fields below it.
|
| Args:
| name: text string of the "/T" Attribute of the created object
|
| Returns:
| The created object. ``None`` means no object was created.
|
| cache_get_indirect_object(self, generation: int, idnum: int) -> Optional[pypdf.generic._base.PdfObject]
|
| cache_indirect_object(self, generation: int, idnum: int, obj: Optional[pypdf.generic._base.PdfObject]) -> Optional[pypdf.generic._base.PdfObject]
|
| close(self) -> None
| Close the stream if opened in __init__ and clear memory.
|
| decrypt(self, password: Union[str, bytes]) -> pypdf._encryption.PasswordType
| When using an encrypted / secured PDF file with the PDF Standard
| encryption handler, this function will allow the file to be decrypted.
| It checks the given password against the document's user password and
| owner password, and then stores the resulting decryption key if either
| password is correct.
|
| It does not matter which password was matched. Both passwords provide
| the correct decryption key that will allow the document to be used with
| this library.
|
| Args:
| password: The password to match.
|
| Returns:
| An indicator if the document was decrypted and whether it was the
| owner password or the user password.
|
| get_object(self, indirect_reference: Union[int, pypdf.generic._base.IndirectObject]) -> Optional[pypdf.generic._base.PdfObject]
|
| read(self, stream: IO[Any]) -> None
| Read and process the PDF stream, extracting necessary data.
|
| Args:
| stream: The PDF file stream.
|
| read_object_header(self, stream: IO[Any]) -> tuple[int, int]
|
| rename_form_topname(self, name: str) -> Optional[pypdf.generic._data_structures.DictionaryObject]
| Rename top level form field that all form fields below it.
|
| Args:
| name: text string of the "/T" field of the created object
|
| Returns:
| The modified object. ``None`` means no object was modified.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| is_encrypted
| Read-only boolean property showing whether this PDF file is encrypted.
|
| Note that this property, if true, will remain true even after the
| :meth:`decrypt()<pypdf.PdfReader.decrypt>` method is called.
|
| pdf_header
| The first 8 bytes of the file.
|
| This is typically something like ``'%PDF-1.6'`` and can be used to
| detect if the file is actually a PDF file and which version it is.
|
| root_object
| Provide access to "/Root". Standardized with PdfWriter.
|
| xmp_metadata
| XMP (Extensible Metadata Platform) data.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._doc_common.PdfDocCommon:
|
| decode_permissions(self, permissions_code: int) -> NoReturn
| Take the permissions as an integer, return the allowed access.
|
| get_destination_page_number(self, destination: pypdf.generic._data_structures.Destination) -> Optional[int]
| Retrieve page number of a given Destination object.
|
| Args:
| destination: The destination to get page number.
|
| Returns:
| The page number or None if page is not found
|
| get_fields(self, tree: Optional[pypdf.generic._data_structures.TreeObject] = None, retval: Optional[dict[Any, Any]] = None, fileobj: Optional[Any] = None, stack: Optional[list[pypdf.generic._base.PdfObject]] = None) -> Optional[dict[str, Any]]
| Extract field data if this PDF contains interactive form fields.
|
| The *tree*, *retval*, *stack* parameters are for recursive use.
|
| Args:
| tree: Current object to parse.
| retval: In-progress list of fields.
| fileobj: A file object (usually a text file) to write
| a report to on all interactive form fields found.
| stack: List of already parsed objects.
|
| Returns:
| A dictionary where each key is a field name, and each
| value is a :class:`Field<pypdf.generic.Field>` object. By
| default, the mapping name is used for keys.
| ``None`` if form data could not be located.
|
| get_form_text_fields(self, full_qualified_name: bool = False) -> dict[str, typing.Any]
| Retrieve form fields from the document with textual data.
|
| Args:
| full_qualified_name: to get full name
|
| Returns:
| A dictionary. The key is the name of the form field,
| the value is the content of the field.
|
| If the document contains multiple form fields with the same name, the
| second and following will get the suffix .2, .3, ...
|
| get_named_dest_root(self) -> pypdf.generic._data_structures.ArrayObject
|
| get_num_pages(self) -> int
| Calculate the number of pages in this PDF file.
|
| Returns:
| The number of pages of the parsed PDF file.
|
| Raises:
| PdfReadError: If restrictions prevent this action.
|
| get_page(self, page_number: int) -> pypdf._page.PageObject
| Retrieve a page by number from this PDF file.
| Most of the time ``.pages[page_number]`` is preferred.
|
| Args:
| page_number: The page number to retrieve
| (pages begin at zero)
|
| Returns:
| A :class:`PageObject<pypdf._page.PageObject>` instance.
|
| get_page_number(self, page: pypdf._page.PageObject) -> Optional[int]
| Retrieve page number of a given PageObject.
|
| Args:
| page: The page to get page number. Should be
| an instance of :class:`PageObject<pypdf._page.PageObject>`
|
| Returns:
| The page number or None if page is not found
|
| get_pages_showing_field(self, field: Union[pypdf.generic._data_structures.Field, pypdf.generic._base.PdfObject, pypdf.generic._base.IndirectObject]) -> list[pypdf._page.PageObject]
| Provides list of pages where the field is called.
|
| Args:
| field: Field Object, PdfObject or IndirectObject referencing a Field
|
| Returns:
| List of pages:
| - Empty list:
| The field has no widgets attached
| (either hidden field or ancestor field).
| - Single page list:
| Page where the widget is present
| (most common).
| - Multi-page list:
| Field with multiple kids widgets
| (example: radio buttons, field repeated on multiple pages).
|
| remove_page(self, page: Union[int, pypdf._page.PageObject, pypdf.generic._base.IndirectObject], clean: bool = False) -> None
| Remove page from pages list.
|
| Args:
| page:
| * :class:`int`: Page number to be removed.
| * :class:`~pypdf._page.PageObject`: page to be removed. If the page appears many times
| only the first one will be removed.
| * :class:`~pypdf.generic.IndirectObject`: Reference to page to be removed.
|
| clean: replace PageObject with NullObject to prevent annotations
| or destinations to reference a detached page.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf._doc_common.PdfDocCommon:
|
| are_permissions_valid
| Whether the ``/Perms`` integrity check passed for this document.
|
| For AES-256 encrypted documents (R=5/R=6), the ``/Perms`` field
| is an encrypted copy of the permissions that can be verified
| independently. Returns ``False`` if this check fails (the ``/P``
| permissions may have been tampered with).
|
| Returns ``None`` if the document is not encrypted or has not yet
| been decrypted via :meth:`decrypt()<pypdf.PdfReader.decrypt>`.
| Returns ``True`` for non-AES-256 encryption (no ``/Perms`` to check).
|
| attachment_list
| Iterable of attachment objects.
|
| attachments
| Mapping of attachment filenames to their content.
|
| metadata
| Retrieve the PDF file's document information dictionary, if it exists.
|
| Note that some PDF files use metadata streams instead of document
| information dictionaries, and these metadata streams will not be
| accessed by this function.
|
| named_destinations
| A read-only dictionary which maps names to destinations.
|
| outline
| Read-only property for the outline present in the document
| (i.e., a collection of 'outline items' which are also known as
| 'bookmarks').
|
| page_labels
| A list of labels for the pages in this document.
|
| This property is read-only. The labels are in the order that the pages
| appear in the document.
|
| page_layout
| Get the page layout currently being used.
|
| .. list-table:: Valid ``layout`` values
| :widths: 50 200
|
| * - /NoLayout
| - Layout explicitly not specified
| * - /SinglePage
| - Show one page at a time
| * - /OneColumn
| - Show one column at a time
| * - /TwoColumnLeft
| - Show pages in two columns, odd-numbered pages on the left
| * - /TwoColumnRight
| - Show pages in two columns, odd-numbered pages on the right
| * - /TwoPageLeft
| - Show two pages at a time, odd-numbered pages on the left
| * - /TwoPageRight
| - Show two pages at a time, odd-numbered pages on the right
|
| page_mode
| Get the page mode currently being used.
|
| .. list-table:: Valid ``mode`` values
| :widths: 50 200
|
| * - /UseNone
| - Do not show outline or thumbnails panels
| * - /UseOutlines
| - Show outline (aka bookmarks) panel
| * - /UseThumbs
| - Show page thumbnails panel
| * - /FullScreen
| - Fullscreen view
| * - /UseOC
| - Show Optional Content Group (OCG) panel
| * - /UseAttachments
| - Show attachments panel
|
| pages
| Property that emulates a list of :class:`PageObject<pypdf._page.PageObject>`.
| This property allows to get a page or a range of pages.
|
| Note:
| For PdfWriter only: Provides the capability to remove a page/range of
| page from the list (using the del operator). Remember: Only the page
| entry is removed, as the objects beneath can be used elsewhere. A
| solution to completely remove them - if they are not used anywhere - is
| to write to a buffer/temporary file and then load it into a new
| PdfWriter.
|
| threads
| Read-only property for the list of threads.
|
| See §12.4.3 from the PDF 1.7 or 2.0 specification.
|
| It is an array of dictionaries with "/F" (the first bead in the thread)
| and "/I" (a thread information dictionary containing information about
| the thread, such as its title, author, and creation date) properties or
| None if there are no articles.
|
| Since PDF 2.0 it can also contain an indirect reference to a metadata
| stream containing information about the thread, such as its title,
| author, and creation date.
|
| user_access_permissions
| Get the user access permissions for encrypted documents.
| Returns None if not encrypted.
|
| .. warning::
|
| For AES-256 encrypted documents (R=5/R=6), the returned
| permissions are derived from the ``/P`` field, which is
| only trustworthy if the ``/Perms`` integrity check passed.
| Check :attr:`are_permissions_valid` to verify.
|
| viewer_preferences
| Returns the existing ViewerPreferences as an overloaded dictionary.
|
| xfa
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._doc_common.PdfDocCommon:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| open_destination
| Property to access the opening destination (``/OpenAction`` entry in
| the PDF catalog). It returns ``None`` if the entry does not exist
| or is not set.
|
| Raises:
| Exception: If a destination is invalid.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._doc_common.PdfDocCommon:
|
| flattened_pages = None
|
| strict = False
pypdf.PdfWriter
Python Library Documentation: class PdfWriter in module pypdf._writer
class PdfWriter(pypdf._doc_common.PdfDocCommon)
| PdfWriter(fileobj: Union[NoneType, pypdf._reader.PdfReader, str, IO[Any], pathlib.Path] = '', clone_from: Union[NoneType, pypdf._reader.PdfReader, str, IO[Any], pathlib.Path] = None, incremental: bool = False, full: bool = False, strict: bool = False, *, incremental_clone_object_count_limit: Optional[int] = 500000, incremental_clone_object_id_limit: Optional[int] = 1000000) -> None
|
| Write a PDF file out, given pages produced by another class or through
| cloning a PDF file during initialization.
|
| Typically data is added from a :class:`PdfReader<pypdf.PdfReader>`.
|
| Args:
| clone_from: identical to fileobj (for compatibility)
|
| incremental: If true, loads the document and set the PdfWriter in incremental mode.
|
| When writing incrementally, the original document is written first and new/modified
| content is appended. To be used for signed document/forms to keep signature valid.
|
| full: If true, loads all the objects (always full if incremental = True).
| This parameter may allow loading large PDFs.
|
| strict: If true, pypdf will raise an exception if a PDF does not follow the specification.
| If false, pypdf will try to be forgiving and do something reasonable, but it will log
| a warning message. It is a best-effort approach.
|
| Method resolution order:
| PdfWriter
| pypdf._doc_common.PdfDocCommon
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self) -> Self
| Store how writer is initialized by 'with'.
|
| __exit__(self, exc_type: Optional[type[BaseException]], exc: Optional[BaseException], traceback: Optional[traceback]) -> None
| Write data to the fileobj.
|
| __init__(self, fileobj: Union[NoneType, pypdf._reader.PdfReader, str, IO[Any], pathlib.Path] = '', clone_from: Union[NoneType, pypdf._reader.PdfReader, str, IO[Any], pathlib.Path] = None, incremental: bool = False, full: bool = False, strict: bool = False, *, incremental_clone_object_count_limit: Optional[int] = 500000, incremental_clone_object_id_limit: Optional[int] = 1000000) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| add_annotation(self, page_number: Union[int, pypdf._page.PageObject], annotation: dict[str, typing.Any]) -> pypdf.generic._data_structures.DictionaryObject
| Add a single annotation to the page.
| The added annotation must be a new annotation.
| It cannot be recycled.
|
| Args:
| page_number: PageObject or page index.
| annotation: Annotation to be added (created with annotation).
|
| Returns:
| The inserted object.
| This can be used for popup creation, for example.
|
| add_attachment(self, filename: str, data: Union[str, bytes]) -> 'EmbeddedFile'
| Embed a file inside the PDF.
|
| Reference:
| https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf
| Section 7.11.3
|
| Args:
| filename: The filename to display.
| data: The data in the file.
|
| Returns:
| EmbeddedFile instance for the newly created embedded file.
|
| add_blank_page(self, width: Optional[float] = None, height: Optional[float] = None) -> pypdf._page.PageObject
| Append a blank page to this PDF file and return it.
|
| If no page size is specified, use the size of the last page.
|
| Args:
| width: The width of the new page expressed in default user
| space units.
| height: The height of the new page expressed in default
| user space units.
|
| Returns:
| The newly appended page.
|
| Raises:
| PageSizeNotDefinedError: if width and height are not defined
| and previous page does not exist.
|
| add_filtered_articles(self, fltr: Union[re.Pattern[Any], str], pages: dict[int, pypdf._page.PageObject], reader: pypdf._reader.PdfReader) -> None
| Add articles matching the defined criteria.
|
| Args:
| fltr:
| pages:
| reader:
|
| add_js(self, javascript: str) -> None
| Add JavaScript which will launch upon opening this PDF.
|
| Args:
| javascript: Your JavaScript.
|
| Example:
| This will launch the print window when the PDF is opened.
|
| >>> from pypdf import PdfWriter
| >>> output = PdfWriter()
| >>> output.add_js("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
|
| add_metadata(self, infos: dict[str, typing.Any]) -> None
| Add custom metadata to the output.
|
| Args:
| infos: a Python dictionary where each key is a field
| and each value is your new metadata.
|
| add_named_destination(self, title: str, page_number: int) -> pypdf.generic._base.IndirectObject
|
| add_named_destination_array(self, title: pypdf.generic._base.TextStringObject, destination: Union[pypdf.generic._base.IndirectObject, pypdf.generic._data_structures.ArrayObject]) -> None
|
| add_named_destination_object(self, page_destination: pypdf.generic._base.PdfObject) -> pypdf.generic._base.IndirectObject
|
| add_outline(self) -> None
|
| add_outline_item(self, title: str, page_number: Union[NoneType, pypdf._page.PageObject, pypdf.generic._base.IndirectObject, int], parent: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, before: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, color: Union[tuple[float, float, float], str, NoneType] = None, bold: bool = False, italic: bool = False, fit: pypdf.generic._fit.Fit = <pypdf.generic._fit.Fit object at 0x0000020A61723FE0>, is_open: bool = True) -> pypdf.generic._base.IndirectObject
| Add an outline item (commonly referred to as a "Bookmark") to the PDF file.
|
| Args:
| title: Title to use for this outline item.
| page_number: Page number this outline item will point to.
| parent: A reference to a parent outline item to create nested
| outline items.
| before:
| color: Color of the outline item's font as a red, green, blue tuple
| from 0.0 to 1.0 or as a Hex String (#RRGGBB)
| bold: Outline item font is bold
| italic: Outline item font is italic
| fit: The fit of the destination page.
|
| Returns:
| The added outline item as an indirect object.
|
| add_outline_item_destination(self, page_destination: Union[pypdf.generic._base.IndirectObject, pypdf._page.PageObject, pypdf.generic._data_structures.TreeObject], parent: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, before: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, is_open: bool = True) -> pypdf.generic._base.IndirectObject
|
| add_outline_item_dict(self, outline_item: Union[pypdf.generic._outline.OutlineItem, pypdf.generic._data_structures.Destination], parent: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, before: Union[NoneType, pypdf.generic._data_structures.TreeObject, pypdf.generic._base.IndirectObject] = None, is_open: bool = True) -> pypdf.generic._base.IndirectObject
|
| add_page(self, page: pypdf._page.PageObject, excluded_keys: collections.abc.Iterable[str] = ()) -> pypdf._page.PageObject
| Add a page to this PDF file.
|
| Recommended for advanced usage including the adequate excluded_keys.
|
| The page is usually acquired from a :class:`PdfReader<pypdf.PdfReader>`
| instance.
|
| Args:
| page: The page to add to the document. Should be
| an instance of :class:`PageObject<pypdf._page.PageObject>`
| excluded_keys:
|
| Returns:
| The added PageObject.
|
| add_uri(self, page_number: int, uri: str, rect: pypdf.generic._rectangle.RectangleObject, border: Optional[pypdf.generic._data_structures.ArrayObject] = None) -> None
| Add an URI from a rectangular area to the specified page.
|
| Args:
| page_number: index of the page on which to place the URI action.
| uri: URI of resource to link to.
| rect: :class:`RectangleObject<pypdf.generic.RectangleObject>` or
| array of four integers specifying the clickable rectangular area
| ``[xLL, yLL, xUR, yUR]``, or string in the form
| ``"[ xLL yLL xUR yUR ]"``.
| border: if provided, an array describing border-drawing
| properties. See the PDF spec for details. No border will be
| drawn if this argument is omitted.
|
| append(self, fileobj: Union[str, IO[Any], pypdf._reader.PdfReader, pathlib.Path], outline_item: Union[str, NoneType, pypdf.pagerange.PageRange, tuple[int, int], tuple[int, int, int], list[int]] = None, pages: Union[NoneType, pypdf.pagerange.PageRange, tuple[int, int], tuple[int, int, int], list[int], list[pypdf._page.PageObject]] = None, import_outline: bool = True, excluded_fields: Union[list[str], tuple[str, ...], NoneType] = None) -> None
| Identical to the :meth:`merge()<merge>` method, but assumes you want to
| concatenate all pages onto the end of the file instead of specifying a
| position.
|
| Args:
| fileobj: A File Object or an object that supports the standard
| read and seek methods similar to a File Object. Could also be a
| string representing a path to a PDF file.
| outline_item: Optionally, you may specify a string to build an
| outline (aka 'bookmark') to identify the beginning of the
| included file.
| pages: Can be a :class:`PageRange<pypdf.pagerange.PageRange>`
| or a ``(start, stop[, step])`` tuple
| or a list of pages to be processed
| to merge only the specified range of pages from the source
| document into the output document.
| import_outline: You may prevent the source document's
| outline (collection of outline items, previously referred to as
| 'bookmarks') from being imported by specifying this as ``False``.
| excluded_fields: Provide the list of fields/keys to be ignored
| if ``/Annots`` is part of the list, the annotation will be ignored
| if ``/B`` is part of the list, the articles will be ignored
|
| append_pages_from_reader(self, reader: pypdf._reader.PdfReader, after_page_append: Optional[Callable[[pypdf._page.PageObject], NoneType]] = None) -> None
| Copy pages from reader to writer. Includes an optional callback
| parameter which is invoked after pages are appended to the writer.
|
| ``append`` should be preferred.
|
| Args:
| reader: a PdfReader object from which to copy page
| annotations to this writer object. The writer's annots
| will then be updated.
| after_page_append:
| Callback function that is invoked after each page is appended to
| the writer. Signature includes a reference to the appended page
| (delegates to append_pages_from_reader). The single parameter of
| the callback is a reference to the page just appended to the
| document.
|
| clean_page(self, page: Union[pypdf._page.PageObject, pypdf.generic._base.IndirectObject]) -> pypdf._page.PageObject
| Perform some clean up in the page.
| Currently: convert NameObject named destination to TextStringObject
| (required for names/dests list)
|
| Args:
| page:
|
| Returns:
| The cleaned PageObject
|
| clone_document_from_reader(self, reader: pypdf._reader.PdfReader, after_page_append: Optional[Callable[[pypdf._page.PageObject], NoneType]] = None) -> None
| Create a copy (clone) of a document from a PDF file reader cloning
| section '/Root' and '/Info' and '/ID' of the pdf.
|
| Args:
| reader: PDF file reader instance from which the clone
| should be created.
| after_page_append:
| Callback function that is invoked after each page is appended to
| the writer. Signature includes a reference to the appended page
| (delegates to append_pages_from_reader). The single parameter of
| the callback is a reference to the page just appended to the
| document.
|
| clone_reader_document_root(self, reader: pypdf._reader.PdfReader) -> None
| Copy the reader document root to the writer and all sub-elements,
| including pages, threads, outlines,... For partial insertion, ``append``
| should be considered.
|
| Args:
| reader: PdfReader from which the document root should be copied.
|
| close(self) -> None
| Implemented for API harmonization.
|
| compress_identical_objects(self, remove_identicals: Any = <object object at 0x0000020A60998ED0>, remove_orphans: Any = <object object at 0x0000020A60998ED0>, *, remove_duplicates: bool = True, remove_unreferenced: bool = True) -> None
| Parse the PDF file and merge objects that have the same hash.
| This will make objects common to multiple pages.
| Recommended to be used just before writing output.
|
| Args:
| remove_identicals: Deprecated.
| remove_orphans: Deprecated.
| remove_duplicates: Remove duplicate objects.
| remove_unreferenced: Remove unreferenced objects.
|
| create_viewer_preferences(self) -> pypdf.generic._viewerpref.ViewerPreferences
|
| encrypt(self, user_password: str, owner_password: Optional[str] = None, use_128bit: bool = True, permissions_flag: pypdf.constants.UserAccessPermissions = <UserAccessPermissions.PRINT|MODIFY|EXTRACT|ADD_OR_MODIFY|R7|R8|FILL_FORM_FIELDS|EXTRACT_TEXT_AND_GRAPHICS|ASSEMBLE_DOC|PRINT_TO_REPRESENTATION|R13|R14|R15|R16|R17|R18|R19|R20|R21|R22|R23|R24|R25|R26|R27|R28|R29|R30|R31|R32: 4294967292>, *, algorithm: Optional[str] = None) -> None
| Encrypt this PDF file with the PDF Standard encryption handler.
|
| Args:
| user_password: The password which allows for opening
| and reading the PDF file with the restrictions provided.
| owner_password: The password which allows for
| opening the PDF files without any restrictions. By default,
| the owner password is the same as the user password.
| use_128bit: flag as to whether to use 128bit
| encryption. When false, 40bit encryption will be used.
| By default, this flag is on.
| permissions_flag: permissions as described in
| Table 3.20 of the PDF 1.7 specification. A bit value of 1 means
| the permission is granted.
| Hence an integer value of -1 will set all flags.
| Bit position 3 is for printing, 4 is for modifying content,
| 5 and 6 control annotations, 9 for form fields,
| 10 for extraction of text and graphics.
| algorithm: encrypt algorithm. Values may be one of "RC4-40", "RC4-128",
| "AES-128", "AES-256-R5", "AES-256". If it is valid,
| `use_128bit` will be ignored.
|
| find_outline_item(self, outline_item: dict[str, typing.Any], root: Optional[list[Union[pypdf.generic._data_structures.Destination, list[Union[pypdf.generic._data_structures.Destination, list[pypdf.generic._data_structures.Destination]]]]]] = None) -> Optional[list[int]]
|
| generate_file_identifiers(self) -> None
| Generate an identifier for the PDF that will be written.
|
| The only point of this is ensuring uniqueness. Reproducibility is not
| required.
| When a file is first written, both identifiers shall be set to the same value.
| If both identifiers match when a file reference is resolved, it is very
| likely that the correct and unchanged file has been found. If only the first
| identifier matches, a different version of the correct file has been found.
| see §14.4 "File Identifiers".
|
| get_object(self, indirect_reference: Union[int, pypdf.generic._base.IndirectObject]) -> pypdf.generic._base.PdfObject
|
| get_outline_root(self) -> pypdf.generic._data_structures.TreeObject
|
| get_reference(self, obj: pypdf.generic._base.PdfObject) -> pypdf.generic._base.IndirectObject
|
| get_threads_root(self) -> pypdf.generic._data_structures.ArrayObject
| The list of threads.
|
| See §12.4.3 of the PDF 1.7 or PDF 2.0 specification.
|
| Returns:
| An array (possibly empty) of Dictionaries with an ``/F`` key,
| and optionally information about the thread in ``/I`` or ``/Metadata`` keys.
|
| insert_blank_page(self, width: Union[float, decimal.Decimal, NoneType] = None, height: Union[float, decimal.Decimal, NoneType] = None, index: int = 0) -> pypdf._page.PageObject
| Insert a blank page to this PDF file and return it.
|
| If no page size is specified for a dimension, use the size of the last page.
|
| Args:
| width: The width of the new page in default user space units.
| height: The height of the new page in default user space units.
| index: Position to add the page.
|
| Returns:
| The newly inserted page.
|
| Raises:
| PageSizeNotDefinedError: if width and height are not defined
| and previous page does not exist.
| IndexError: Index is outside of [-self.get_num_pages(), self.get_num_pages()]
|
| insert_page(self, page: pypdf._page.PageObject, index: int = 0, excluded_keys: collections.abc.Iterable[str] = ()) -> pypdf._page.PageObject
| Insert a page in this PDF file. The page is usually acquired from a
| :class:`PdfReader<pypdf.PdfReader>` instance.
|
| Args:
| page: The page to add to the document.
| index: Position at which the page will be inserted.
| excluded_keys:
|
| Returns:
| The added PageObject.
|
| list_objects_in_increment(self) -> list[pypdf.generic._base.IndirectObject]
| For analysis or debugging.
| Provides the list of new or modified objects that will be written
| in the increment.
| Deleted objects will not be freed but will become orphans.
|
| Returns:
| List of new or modified IndirectObjects
|
| merge(self, position: Optional[int], fileobj: Union[pathlib.Path, str, IO[Any], pypdf._reader.PdfReader], outline_item: Optional[str] = None, pages: Union[str, pypdf.pagerange.PageRange, tuple[int, int], tuple[int, int, int], list[int], list[pypdf._page.PageObject], NoneType] = None, import_outline: bool = True, excluded_fields: Union[list[str], tuple[str, ...], NoneType] = ()) -> None
| Merge the pages from the given file into the output file at the
| specified page number.
|
| Args:
| position: The *page number* to insert this file. File will
| be inserted after the given number.
| fileobj: A File Object or an object that supports the standard
| read and seek methods similar to a File Object. Could also be a
| string representing a path to a PDF file.
| outline_item: Optionally, you may specify a string to build an outline
| (aka 'bookmark') to identify the
| beginning of the included file.
| pages: can be a :class:`PageRange<pypdf.pagerange.PageRange>`
| or a ``(start, stop[, step])`` tuple
| or a list of pages to be processed
| to merge only the specified range of pages from the source
| document into the output document.
| import_outline: You may prevent the source document's
| outline (collection of outline items, previously referred to as
| 'bookmarks') from being imported by specifying this as ``False``.
| excluded_fields: provide the list of fields/keys to be ignored
| if ``/Annots`` is part of the list, the annotation will be ignored
| if ``/B`` is part of the list, the articles will be ignored
|
| Raises:
| TypeError: The pages attribute is not configured properly
|
| reattach_fields(self, page: Optional[pypdf._page.PageObject] = None) -> list[pypdf.generic._data_structures.DictionaryObject]
| Parse annotations within the page looking for orphan fields and
| reattach then into the Fields Structure.
|
| Args:
| page: page to analyze.
| If none is provided, all pages will be analyzed.
|
| Returns:
| list of reattached fields.
|
| remove_annotations(self, subtypes: Union[Literal['/Text', '/Link', '/FreeText', '/Line', '/Square', '/Circle', '/Polygon', '/PolyLine', '/Highlight', '/Underline', '/Squiggly', '/StrikeOut', '/Caret', '/Stamp', '/Ink', '/Popup', '/FileAttachment', '/Sound', '/Movie', '/Screen', '/Widget', '/PrinterMark', '/TrapNet', '/Watermark', '/3D', '/Redact', '/Projection', '/RichMedia'], collections.abc.Iterable[Literal['/Text', '/Link', '/FreeText', '/Line', '/Square', '/Circle', '/Polygon', '/PolyLine', '/Highlight', '/Underline', '/Squiggly', '/StrikeOut', '/Caret', '/Stamp', '/Ink', '/Popup', '/FileAttachment', '/Sound', '/Movie', '/Screen', '/Widget', '/PrinterMark', '/TrapNet', '/Watermark', '/3D', '/Redact', '/Projection', '/RichMedia']], NoneType]) -> None
| Remove annotations by annotation subtype.
|
| Args:
| subtypes: subtype or list of subtypes to be removed.
| Examples are: "/Link", "/FileAttachment", "/Sound",
| "/Movie", "/Screen", ...
| If you want to remove all annotations, use subtypes=None.
|
| remove_images(self, to_delete: pypdf.constants.ImageType = <ImageType.ALL: 7>) -> None
| Remove images from this output.
|
| Args:
| to_delete: The type of images to be deleted
| (default = all images types)
|
| remove_links(self) -> None
| Remove links and annotations from this output.
|
| remove_objects_from_page(self, page: Union[pypdf._page.PageObject, pypdf.generic._data_structures.DictionaryObject], to_delete: Union[pypdf._writer.ObjectDeletionFlag, collections.abc.Iterable[pypdf._writer.ObjectDeletionFlag]], text_filters: Optional[dict[str, Any]] = None) -> None
| Remove objects specified by ``to_delete`` from the given page.
|
| Args:
| page: Page object to clean up.
| to_delete: Objects to be deleted; can be a ``ObjectDeletionFlag``
| or a list of ObjectDeletionFlag
| text_filters: Properties of text to be deleted, if applicable. Optional.
| This is a Python dictionary with the following properties:
|
| * font_ids: List of font resource IDs (such as /F1 or /T1_0) to be deleted.
|
| remove_text(self, font_names: Optional[list[str]] = None) -> None
| Remove text from the PDF.
|
| Args:
| font_names: List of font names to remove, such as "Helvetica-Bold".
| Optional. If not specified, all text will be removed.
|
| reset_translation(self, reader: Union[NoneType, pypdf._reader.PdfReader, pypdf.generic._base.IndirectObject] = None) -> None
| Reset the translation table between reader and the writer object.
|
| Late cloning will create new independent objects.
|
| Args:
| reader: PdfReader or IndirectObject referencing a PdfReader object.
| if set to None or omitted, all tables will be reset.
|
| set_need_appearances_writer(self, state: bool = True) -> None
| Sets the "NeedAppearances" flag in the PDF writer.
|
| The "NeedAppearances" flag indicates whether the appearance dictionary
| for form fields should be automatically generated by the PDF viewer or
| if the embedded appearance should be used.
|
| Args:
| state: The actual value of the NeedAppearances flag.
|
| Returns:
| None
|
| set_page_label(self, page_index_from: int, page_index_to: int, style: Optional[pypdf.constants.PageLabelStyle] = None, prefix: Optional[str] = None, start: Optional[int] = 0) -> None
| Set a page label to a range of pages.
|
| Page indexes must be given starting from 0.
| Labels must have a style, a prefix or both.
| If a range is not assigned any page label, a decimal label starting from 1 is applied.
|
| Args:
| page_index_from: page index of the beginning of the range starting from 0
| page_index_to: page index of the beginning of the range starting from 0
| style: The numbering style to be used for the numeric portion of each page label:
|
| * ``/D`` Decimal Arabic numerals
| * ``/R`` Uppercase Roman numerals
| * ``/r`` Lowercase Roman numerals
| * ``/A`` Uppercase letters (A to Z for the first 26 pages,
| AA to ZZ for the next 26, and so on)
| * ``/a`` Lowercase letters (a to z for the first 26 pages,
| aa to zz for the next 26, and so on)
|
| prefix: The label prefix for page labels in this range.
| start: The value of the numeric portion for the first page label
| in the range.
| Subsequent pages are numbered sequentially from this value,
| which must be greater than or equal to 1.
| Default value: 1.
|
| set_page_layout(self, layout: Literal['/NoLayout', '/SinglePage', '/OneColumn', '/TwoColumnLeft', '/TwoColumnRight', '/TwoPageLeft', '/TwoPageRight']) -> None
| Set the page layout.
|
| Args:
| layout: The page layout to be used
|
| .. list-table:: Valid ``layout`` arguments
| :widths: 50 200
|
| * - /NoLayout
| - Layout explicitly not specified
| * - /SinglePage
| - Show one page at a time
| * - /OneColumn
| - Show one column at a time
| * - /TwoColumnLeft
| - Show pages in two columns, odd-numbered pages on the left
| * - /TwoColumnRight
| - Show pages in two columns, odd-numbered pages on the right
| * - /TwoPageLeft
| - Show two pages at a time, odd-numbered pages on the left
| * - /TwoPageRight
| - Show two pages at a time, odd-numbered pages on the right
|
| update_page_form_field_values(self, page: Union[pypdf._page.PageObject, list[pypdf._page.PageObject], NoneType], fields: collections.abc.Mapping[str, typing.Union[str, list[str], tuple[str, str, float]]], flags: pypdf.constants.FieldDictionaryAttributes.FfBits = <FfBits: 0>, auto_regenerate: Optional[bool] = True, flatten: bool = False) -> None
| Update the form field values for a given page from a fields dictionary.
|
| Copy field texts and values from fields to page.
| If the field links to a parent object, add the information to the parent.
|
| Args:
| page: `PageObject` - references **PDF writer's page** where the
| annotations and field data will be updated.
| `List[Pageobject]` - provides list of pages to be processed.
| `None` - all pages.
| fields: a Python dictionary of:
|
| * field names (/T) as keys and text values (/V) as value
| * field names (/T) as keys and list of text values (/V) for multiple choice list
| * field names (/T) as keys and tuple of:
| * text values (/V)
| * font id (e.g. /F1, the font id must exist)
| * font size (0 for autosize)
|
| flags: A set of flags from :class:`~pypdf.constants.FieldDictionaryAttributes.FfBits`.
|
| auto_regenerate: Set/unset the need_appearances flag;
| the flag is unchanged if auto_regenerate is None.
|
| flatten: Whether or not to flatten the annotation. If True, this adds the annotation's
| appearance stream to the page contents. Note that this option does not remove the
| annotation itself.
|
| write(self, stream: Union[pathlib.Path, str, IO[Any]]) -> tuple[bool, typing.IO[typing.Any]]
| Write the collection of pages added to this object out as a PDF file.
|
| Args:
| stream: An object to write the file to. The object can support
| the write method and the tell method, similar to a file object, or
| be a file path, just like the fileobj, just named it stream to keep
| existing workflow.
|
| Returns:
| A tuple (bool, IO).
|
| write_stream(self, stream: IO[Any]) -> None
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| is_encrypted
| Read-only boolean property showing whether this PDF file is encrypted.
|
| Note that this property, if true, will remain true even after the
| :meth:`decrypt()<pypdf.PdfReader.decrypt>` method is called.
|
| root_object
| Provide direct access to PDF Structure.
|
| Note:
| Recommended only for read access.
|
| threads
| Read-only property for the list of threads.
|
| See §12.4.3 of the PDF 1.7 or PDF 2.0 specification.
|
| Each element is a dictionary with an ``/F`` key, and optionally
| information about the thread in ``/I`` or ``/Metadata`` keys.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| metadata
| Retrieve/set the PDF file's document information dictionary, if it exists.
|
| Args:
| value: dict with the entries to be set. if None : remove the /Info entry from the pdf.
|
| Note that some PDF files use (XMP) metadata streams instead of document
| information dictionaries, and these metadata streams will not be
| accessed by this function, but by :meth:`~xmp_metadata`.
|
| open_destination
| Property to access the opening destination (``/OpenAction`` entry in
| the PDF catalog). It returns ``None`` if the entry does not exist
| or is not set.
|
| Raises:
| Exception: If a destination is invalid.
|
| page_layout
| Page layout property.
|
| .. list-table:: Valid ``layout`` values
| :widths: 50 200
|
| * - /NoLayout
| - Layout explicitly not specified
| * - /SinglePage
| - Show one page at a time
| * - /OneColumn
| - Show one column at a time
| * - /TwoColumnLeft
| - Show pages in two columns, odd-numbered pages on the left
| * - /TwoColumnRight
| - Show pages in two columns, odd-numbered pages on the right
| * - /TwoPageLeft
| - Show two pages at a time, odd-numbered pages on the left
| * - /TwoPageRight
| - Show two pages at a time, odd-numbered pages on the right
|
| page_mode
| Page mode property.
|
| .. list-table:: Valid ``mode`` values
| :widths: 50 200
|
| * - /UseNone
| - Do not show outline or thumbnails panels
| * - /UseOutlines
| - Show outline (aka bookmarks) panel
| * - /UseThumbs
| - Show page thumbnails panel
| * - /FullScreen
| - Fullscreen view
| * - /UseOC
| - Show Optional Content Group (OCG) panel
| * - /UseAttachments
| - Show attachments panel
|
| pdf_header
| Read/Write property of the PDF header that is written.
|
| This should be something like ``'%PDF-1.5'``. It is recommended to set
| the lowest version that supports all features which are used within the
| PDF file.
|
| Note: `pdf_header` returns a string but accepts bytes or str for writing
|
| with_as_usage
|
| xmp_metadata
| XMP (Extensible Metadata Platform) data.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| FFBITS_NUL = <FfBits: 0>
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._doc_common.PdfDocCommon:
|
| decode_permissions(self, permissions_code: int) -> NoReturn
| Take the permissions as an integer, return the allowed access.
|
| get_destination_page_number(self, destination: pypdf.generic._data_structures.Destination) -> Optional[int]
| Retrieve page number of a given Destination object.
|
| Args:
| destination: The destination to get page number.
|
| Returns:
| The page number or None if page is not found
|
| get_fields(self, tree: Optional[pypdf.generic._data_structures.TreeObject] = None, retval: Optional[dict[Any, Any]] = None, fileobj: Optional[Any] = None, stack: Optional[list[pypdf.generic._base.PdfObject]] = None) -> Optional[dict[str, Any]]
| Extract field data if this PDF contains interactive form fields.
|
| The *tree*, *retval*, *stack* parameters are for recursive use.
|
| Args:
| tree: Current object to parse.
| retval: In-progress list of fields.
| fileobj: A file object (usually a text file) to write
| a report to on all interactive form fields found.
| stack: List of already parsed objects.
|
| Returns:
| A dictionary where each key is a field name, and each
| value is a :class:`Field<pypdf.generic.Field>` object. By
| default, the mapping name is used for keys.
| ``None`` if form data could not be located.
|
| get_form_text_fields(self, full_qualified_name: bool = False) -> dict[str, typing.Any]
| Retrieve form fields from the document with textual data.
|
| Args:
| full_qualified_name: to get full name
|
| Returns:
| A dictionary. The key is the name of the form field,
| the value is the content of the field.
|
| If the document contains multiple form fields with the same name, the
| second and following will get the suffix .2, .3, ...
|
| get_named_dest_root(self) -> pypdf.generic._data_structures.ArrayObject
|
| get_num_pages(self) -> int
| Calculate the number of pages in this PDF file.
|
| Returns:
| The number of pages of the parsed PDF file.
|
| Raises:
| PdfReadError: If restrictions prevent this action.
|
| get_page(self, page_number: int) -> pypdf._page.PageObject
| Retrieve a page by number from this PDF file.
| Most of the time ``.pages[page_number]`` is preferred.
|
| Args:
| page_number: The page number to retrieve
| (pages begin at zero)
|
| Returns:
| A :class:`PageObject<pypdf._page.PageObject>` instance.
|
| get_page_number(self, page: pypdf._page.PageObject) -> Optional[int]
| Retrieve page number of a given PageObject.
|
| Args:
| page: The page to get page number. Should be
| an instance of :class:`PageObject<pypdf._page.PageObject>`
|
| Returns:
| The page number or None if page is not found
|
| get_pages_showing_field(self, field: Union[pypdf.generic._data_structures.Field, pypdf.generic._base.PdfObject, pypdf.generic._base.IndirectObject]) -> list[pypdf._page.PageObject]
| Provides list of pages where the field is called.
|
| Args:
| field: Field Object, PdfObject or IndirectObject referencing a Field
|
| Returns:
| List of pages:
| - Empty list:
| The field has no widgets attached
| (either hidden field or ancestor field).
| - Single page list:
| Page where the widget is present
| (most common).
| - Multi-page list:
| Field with multiple kids widgets
| (example: radio buttons, field repeated on multiple pages).
|
| remove_page(self, page: Union[int, pypdf._page.PageObject, pypdf.generic._base.IndirectObject], clean: bool = False) -> None
| Remove page from pages list.
|
| Args:
| page:
| * :class:`int`: Page number to be removed.
| * :class:`~pypdf._page.PageObject`: page to be removed. If the page appears many times
| only the first one will be removed.
| * :class:`~pypdf.generic.IndirectObject`: Reference to page to be removed.
|
| clean: replace PageObject with NullObject to prevent annotations
| or destinations to reference a detached page.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf._doc_common.PdfDocCommon:
|
| are_permissions_valid
| Whether the ``/Perms`` integrity check passed for this document.
|
| For AES-256 encrypted documents (R=5/R=6), the ``/Perms`` field
| is an encrypted copy of the permissions that can be verified
| independently. Returns ``False`` if this check fails (the ``/P``
| permissions may have been tampered with).
|
| Returns ``None`` if the document is not encrypted or has not yet
| been decrypted via :meth:`decrypt()<pypdf.PdfReader.decrypt>`.
| Returns ``True`` for non-AES-256 encryption (no ``/Perms`` to check).
|
| attachment_list
| Iterable of attachment objects.
|
| attachments
| Mapping of attachment filenames to their content.
|
| named_destinations
| A read-only dictionary which maps names to destinations.
|
| outline
| Read-only property for the outline present in the document
| (i.e., a collection of 'outline items' which are also known as
| 'bookmarks').
|
| page_labels
| A list of labels for the pages in this document.
|
| This property is read-only. The labels are in the order that the pages
| appear in the document.
|
| pages
| Property that emulates a list of :class:`PageObject<pypdf._page.PageObject>`.
| This property allows to get a page or a range of pages.
|
| Note:
| For PdfWriter only: Provides the capability to remove a page/range of
| page from the list (using the del operator). Remember: Only the page
| entry is removed, as the objects beneath can be used elsewhere. A
| solution to completely remove them - if they are not used anywhere - is
| to write to a buffer/temporary file and then load it into a new
| PdfWriter.
|
| user_access_permissions
| Get the user access permissions for encrypted documents.
| Returns None if not encrypted.
|
| .. warning::
|
| For AES-256 encrypted documents (R=5/R=6), the returned
| permissions are derived from the ``/P`` field, which is
| only trustworthy if the ``/Perms`` integrity check passed.
| Check :attr:`are_permissions_valid` to verify.
|
| viewer_preferences
| Returns the existing ViewerPreferences as an overloaded dictionary.
|
| xfa
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._doc_common.PdfDocCommon:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._doc_common.PdfDocCommon:
|
| flattened_pages = None
|
| strict = False
pypdf.Transformation
Python Library Documentation: class Transformation in module pypdf._page class Transformation(builtins.object) | Transformation(ctm: tuple[float, float, float, float, float, float] = (1, 0, 0, 1, 0, 0)) -> None | | Represent a 2D transformation. | | The transformation between two coordinate systems is represented by a 3-by-3 | transformation matrix with the following form:: | | a b 0 | c d 0 | e f 1 | | Because a transformation matrix has only six elements that can be changed, | it is usually specified in PDF as the six-element array [ a b c d e f ]. | | Coordinate transformations are expressed as matrix multiplications:: | | a b 0 | [ x′ y′ 1 ] = [ x y 1 ] × c d 0 | e f 1 | | | Example: | >>> from pypdf import PdfWriter, Transformation | >>> page = PdfWriter().add_blank_page(800, 600) | >>> op = Transformation().scale(sx=2, sy=3).translate(tx=10, ty=20) | >>> page.add_transformation(op) | | Methods defined here: | | __init__(self, ctm: tuple[float, float, float, float, float, float] = (1, 0, 0, 1, 0, 0)) -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) -> str | Return repr(self). | | apply_on(self, pt: Union[tuple[float, float], list[float]], as_object: bool = False) -> Union[tuple[float, float], list[float]] | Apply the transformation matrix on the given point. | | Args: | pt: A tuple or list representing the point in the form (x, y). | as_object: If True, return items as FloatObject, otherwise as plain floats. | | Returns: | A tuple or list representing the transformed point in the form (x', y') | | rotate(self, rotation: float) -> 'Transformation' | Rotate the contents of a page. | | Args: | rotation: The angle of rotation in degrees. | | Returns: | A new ``Transformation`` instance with the rotated matrix. | | scale(self, sx: Optional[float] = None, sy: Optional[float] = None) -> 'Transformation' | Scale the contents of a page towards the origin of the coordinate system. | | Typically, that is the lower-left corner of the page. That can be | changed by translating the contents / the page boxes. | | Args: | sx: The scale factor along the x-axis. | sy: The scale factor along the y-axis. | | Returns: | A new Transformation instance with the scaled matrix. | | transform(self, m: 'Transformation') -> 'Transformation' | Apply one transformation to another. | | Args: | m: a Transformation to apply. | | Returns: | A new ``Transformation`` instance | | Example: | >>> from pypdf import PdfWriter, Transformation | >>> height, width = 40, 50 | >>> page = PdfWriter().add_blank_page(800, 600) | >>> op = Transformation((1, 0, 0, -1, 0, height)) # vertical mirror | >>> op = Transformation().transform(Transformation((-1, 0, 0, 1, width, 0))) # horizontal mirror | >>> page.add_transformation(op) | | translate(self, tx: float = 0, ty: float = 0) -> 'Transformation' | Translate the contents of a page. | | Args: | tx: The translation along the x-axis. | ty: The translation along the y-axis. | | Returns: | A new ``Transformation`` instance | | ---------------------------------------------------------------------- | Static methods defined here: | | compress(matrix: tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]) -> tuple[float, float, float, float, float, float] | Compresses the transformation matrix into a tuple of (a, b, c, d, e, f). | | Args: | matrix: The transformation matrix as a tuple of tuples. | | Returns: | A tuple representing the transformation matrix as (a, b, c, d, e, f) | | ---------------------------------------------------------------------- | Readonly properties defined here: | | matrix | Return the transformation matrix as a tuple of tuples in the form: | | ((a, b, 0), (c, d, 0), (e, f, 1)) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
pypdf.constants
Python Library Documentation: module pypdf.constants in pypdf
NAME
pypdf.constants - Various constants, enums, and flags to aid readability.
CLASSES
builtins.object
AFRelationship
AnnotationDictionaryAttributes
BorderStyles
CatalogAttributes
CatalogDictionary
CcittFaxDecodeParameters
CheckboxRadioButtonAttributes
ColorSpaces
Core
DocumentInformationAttributes
EncryptionDictAttributes
FieldDictionaryAttributes
FileSpecificationDictionaryEntries
FilterTypeAbbreviations
GoToActionArguments
GraphicsStateParameters
ImageAttributes
InteractiveFormDictEntries
LzwFilterParameters
PageAttributes
PageLabelStyle
PageLayouts
PagesAttributes
Resources
StreamAttributes
TrailerKeys
TypArguments
TypFitArguments
builtins.str(builtins.object)
StrEnum(builtins.str, enum.Enum)
FilterTypes
enum.Enum(builtins.object)
StrEnum(builtins.str, enum.Enum)
FilterTypes
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
AnnotationFlag
FieldFlag
FontFlags
ImageType
OutlineFontFlag
UserAccessPermissions
class AFRelationship(builtins.object)
| Associated file relationship types, defining the relationship between
| the PDF component and the associated file.
|
| Defined in table 43 of the PDF 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ALTERNATIVE = '/Alternative'
|
| DATA = '/Data'
|
| ENCRYPTED_PAYLOAD = '/EncryptedPayload'
|
| FORM_DATA = '/FormData'
|
| SCHEMA = '/Schema'
|
| SOURCE = '/Source'
|
| SUPPLEMENT = '/Supplement'
|
| UNSPECIFIED = '/Unspecified'
class AnnotationDictionaryAttributes(builtins.object)
| Table 8.15 Entries common to all annotation dictionaries.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AP = '/AP'
|
| AS = '/AS'
|
| Border = '/Border'
|
| C = '/C'
|
| Contents = '/Contents'
|
| DA = '/DA'
|
| F = '/F'
|
| M = '/M'
|
| NM = '/NM'
|
| OC = '/OC'
|
| P = '/P'
|
| Rect = '/Rect'
|
| StructParent = '/StructParent'
|
| Subtype = '/Subtype'
|
| Type = '/Type'
class AnnotationFlag(enum.IntFlag)
| AnnotationFlag(*values)
|
| See §12.5.3 "Annotation Flags".
|
| Method resolution order:
| AnnotationFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| HIDDEN = <AnnotationFlag.HIDDEN: 2>
|
| INVISIBLE = <AnnotationFlag.INVISIBLE: 1>
|
| LOCKED = <AnnotationFlag.LOCKED: 128>
|
| LOCKED_CONTENTS = <AnnotationFlag.LOCKED_CONTENTS: 512>
|
| NO_ROTATE = <AnnotationFlag.NO_ROTATE: 16>
|
| NO_VIEW = <AnnotationFlag.NO_VIEW: 32>
|
| NO_ZOOM = <AnnotationFlag.NO_ZOOM: 8>
|
| PRINT = <AnnotationFlag.PRINT: 4>
|
| READ_ONLY = <AnnotationFlag.READ_ONLY: 64>
|
| TOGGLE_NO_VIEW = <AnnotationFlag.TOGGLE_NO_VIEW: 256>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class BorderStyles(builtins.object)
| A class defining border styles used in PDF documents.
|
| Defined in table 168 of the PDF 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BEVELED = '/B'
|
| DASHED = '/D'
|
| INSET = '/I'
|
| SOLID = '/S'
|
| UNDERLINED = '/U'
class CatalogAttributes(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DESTS = '/Dests'
|
| NAMES = '/Names'
class CatalogDictionary(builtins.object)
| §7.7.2 of the 1.7 and 2.0 references.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AA = '/AA'
|
| ACRO_FORM = '/AcroForm'
|
| AF = '/AF'
|
| COLLECTION = '/Collection'
|
| DESTS = '/Dests'
|
| DSS = '/DSS'
|
| D_PART_ROOT = '/DPartRoot'
|
| EXTENSIONS = '/Extensions'
|
| LANG = '/Lang'
|
| LEGAL = '/Legal'
|
| MARK_INFO = '/MarkInfo'
|
| METADATA = '/Metadata'
|
| NAMES = '/Names'
|
| NEEDS_RENDERING = '/NeedsRendering'
|
| OC_PROPERTIES = '/OCProperties'
|
| OPEN_ACTION = '/OpenAction'
|
| OUTLINES = '/Outlines'
|
| OUTPUT_INTENTS = '/OutputIntents'
|
| PAGES = '/Pages'
|
| PAGE_LABELS = '/PageLabels'
|
| PAGE_LAYOUT = '/PageLayout'
|
| PAGE_MODE = '/PageMode'
|
| PERMS = '/Perms'
|
| PIECE_INFO = '/PieceInfo'
|
| REQUIREMENTS = '/Requirements'
|
| SPIDER_INFO = '/SpiderInfo'
|
| STRUCT_TREE_ROOT = '/StructTreeRoot'
|
| THREADS = '/Threads'
|
| TYPE = '/Type'
|
| URI = '/URI'
|
| VERSION = '/Version'
|
| VIEWER_PREFERENCES = '/ViewerPreferences'
class CcittFaxDecodeParameters(builtins.object)
| Table 4.5.
| Table 11 in the 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BLACK_IS_1 = '/BlackIs1'
|
| COLUMNS = '/Columns'
|
| DAMAGED_ROWS_BEFORE_ERROR = '/DamagedRowsBeforeError'
|
| ENCODED_BYTE_ALIGN = '/EncodedByteAlign'
|
| END_OF_BLOCK = '/EndOfBlock'
|
| END_OF_LINE = '/EndOfLine'
|
| K = '/K'
|
| ROWS = '/Rows'
class CheckboxRadioButtonAttributes(builtins.object)
| Table 8.76 Field flags common to all field types.
|
| Class methods defined here:
|
| attributes() -> tuple[str, ...]
| Get a tuple of all the attributes present in a Field Dictionary.
|
| This method returns a tuple of all the attribute constants defined in
| the CheckboxRadioButtonAttributes class. These attributes correspond to
| the entries that are common to all field dictionaries as specified in
| the PDF 1.7 reference.
|
| Returns:
| A tuple containing all the attribute constants.
|
| attributes_dict() -> dict[str, str]
| Get a dictionary of attribute keys and their human-readable names.
|
| This method returns a dictionary where the keys are the attribute
| constants defined in the CheckboxRadioButtonAttributes class and the
| values are their corresponding human-readable names. These attributes
| correspond to the entries that are common to all field dictionaries as
| specified in the PDF 1.7 reference.
|
| Returns:
| A dictionary containing attribute keys and their names.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| Opt = '/Opt'
class ColorSpaces(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DEVICE_CMYK = '/DeviceCMYK'
|
| DEVICE_GRAY = '/DeviceGray'
|
| DEVICE_RGB = '/DeviceRGB'
class Core(builtins.object)
| Keywords that don't quite belong anywhere else.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CATALOG = '/Catalog'
|
| OUTLINES = '/Outlines'
|
| PAGE = '/Page'
|
| PAGES = '/Pages'
|
| THREADS = '/Threads'
class DocumentInformationAttributes(builtins.object)
| Table 10.2 Entries in the document information dictionary.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AUTHOR = '/Author'
|
| CREATION_DATE = '/CreationDate'
|
| CREATOR = '/Creator'
|
| KEYWORDS = '/Keywords'
|
| MOD_DATE = '/ModDate'
|
| PRODUCER = '/Producer'
|
| SUBJECT = '/Subject'
|
| TITLE = '/Title'
|
| TRAPPED = '/Trapped'
class EncryptionDictAttributes(builtins.object)
| Additional encryption dictionary entries for the standard security handler.
|
| Table 3.19, Page 122.
| Table 21 of the 2.0 manual.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ENCRYPT_METADATA = '/EncryptMetadata'
|
| O = '/O'
|
| P = '/P'
|
| R = '/R'
|
| U = '/U'
class FieldDictionaryAttributes(builtins.object)
| Entries common to all field dictionaries (Table 8.69 PDF 1.7 reference)
| (*very partially documented here*).
|
| FFBits provides the constants used for `/Ff` from Table 8.70/8.75/8.77/8.79
|
| Class methods defined here:
|
| attributes() -> tuple[str, ...]
| Get a tuple of all the attributes present in a Field Dictionary.
|
| This method returns a tuple of all the attribute constants defined in
| the FieldDictionaryAttributes class. These attributes correspond to the
| entries that are common to all field dictionaries as specified in the
| PDF 1.7 reference.
|
| Returns:
| A tuple containing all the attribute constants.
|
| attributes_dict() -> dict[str, str]
| Get a dictionary of attribute keys and their human-readable names.
|
| This method returns a dictionary where the keys are the attribute
| constants defined in the FieldDictionaryAttributes class and the values
| are their corresponding human-readable names. These attributes
| correspond to the entries that are common to all field dictionaries as
| specified in the PDF 1.7 reference.
|
| Returns:
| A dictionary containing attribute keys and their names.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AA = '/AA'
|
| DV = '/DV'
|
| FT = '/FT'
|
| Ff = '/Ff'
|
| FfBits = <flag 'FfBits'>
| Ease building /Ff flags
| Some entries may be specific to:
|
| * Text (Tx) (Table 8.75 PDF 1.7 reference)
| * Buttons (Btn) (Table 8.77 PDF 1.7 reference)
| * Choice (Ch) (Table 8.79 PDF 1.7 reference)
|
|
| Kids = '/Kids'
|
| Opt = '/Opt'
|
| Parent = '/Parent'
|
| T = '/T'
|
| TM = '/TM'
|
| TU = '/TU'
|
| V = '/V'
class FieldFlag(enum.IntFlag)
| FieldFlag(*values)
|
| Table 8.70 Field flags common to all field types.
|
| Method resolution order:
| FieldFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| NO_EXPORT = <FieldFlag.NO_EXPORT: 4>
|
| READ_ONLY = <FieldFlag.READ_ONLY: 1>
|
| REQUIRED = <FieldFlag.REQUIRED: 2>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class FileSpecificationDictionaryEntries(builtins.object)
| Table 3.41 Entries in a file specification dictionary.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| Cl = '/Cl'
|
| DESC = '/Desc'
|
| DOS = '/DOS'
|
| EF = '/EF'
|
| F = '/F'
|
| FS = '/FS'
|
| ID = '/ID'
|
| Mac = '/Mac'
|
| RF = '/RF'
|
| Type = '/Type'
|
| UF = '/UF'
|
| Unix = '/Unix'
|
| V = '/V'
class FilterTypeAbbreviations(builtins.object)
| §8.9.7 of the 1.7 and 2.0 references.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| A85 = '/A85'
|
| AHx = '/AHx'
|
| CCF = '/CCF'
|
| DCT = '/DCT'
|
| FL = '/Fl'
|
| LZW = '/LZW'
|
| RL = '/RL'
class FilterTypes(StrEnum)
| FilterTypes(*values)
|
| §7.4 of the 1.7 and 2.0 references.
|
| Method resolution order:
| FilterTypes
| StrEnum
| builtins.str
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII_85_DECODE = <FilterTypes.ASCII_85_DECODE: '/ASCII85Decode'>
|
| ASCII_HEX_DECODE = <FilterTypes.ASCII_HEX_DECODE: '/ASCIIHexDecode'>
|
| CCITT_FAX_DECODE = <FilterTypes.CCITT_FAX_DECODE: '/CCITTFaxDecode'>
|
| DCT_DECODE = <FilterTypes.DCT_DECODE: '/DCTDecode'>
|
| FLATE_DECODE = <FilterTypes.FLATE_DECODE: '/FlateDecode'>
|
| JBIG2_DECODE = <FilterTypes.JBIG2_DECODE: '/JBIG2Decode'>
|
| JPX_DECODE = <FilterTypes.JPX_DECODE: '/JPXDecode'>
|
| LZW_DECODE = <FilterTypes.LZW_DECODE: '/LZWDecode'>
|
| RUN_LENGTH_DECODE = <FilterTypes.RUN_LENGTH_DECODE: '/RunLengthDecode'...
|
| ----------------------------------------------------------------------
| Methods inherited from StrEnum:
|
| __format__(self, format_spec) from enum.Enum
| Default object formatter.
|
| Return str(self) if format_spec is empty. Raise TypeError otherwise.
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__(self) -> str
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.str:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __sizeof__(self, /)
| Return the size of the string in memory, in bytes.
|
| capitalize(self, /)
| Return a capitalized version of the string.
|
| More specifically, make the first character have upper case and the rest lower
| case.
|
| casefold(self, /)
| Return a version of the string suitable for caseless comparisons.
|
| center(self, width, fillchar=' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| count(...)
| S.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are
| interpreted as in slice notation.
|
| encode(self, /, encoding='utf-8', errors='strict')
| Encode the string using the codec registered for encoding.
|
| encoding
| The encoding in which to encode the string.
| errors
| The error handling scheme to use for encoding errors.
| The default is 'strict' meaning that encoding errors raise a
| UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
| 'xmlcharrefreplace' as well as any other name registered with
| codecs.register_error that can handle UnicodeEncodeErrors.
|
| endswith(...)
| S.endswith(suffix[, start[, end]]) -> bool
|
| Return True if S ends with the specified suffix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| suffix can also be a tuple of strings to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| S.find(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| format(...)
| S.format(*args, **kwargs) -> str
|
| Return a formatted version of S, using substitutions from args and kwargs.
| The substitutions are identified by braces ('{' and '}').
|
| format_map(...)
| S.format_map(mapping) -> str
|
| Return a formatted version of S, using substitutions from mapping.
| The substitutions are identified by braces ('{' and '}').
|
| index(...)
| S.index(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| isalnum(self, /)
| Return True if the string is an alpha-numeric string, False otherwise.
|
| A string is alpha-numeric if all characters in the string are alpha-numeric and
| there is at least one character in the string.
|
| isalpha(self, /)
| Return True if the string is an alphabetic string, False otherwise.
|
| A string is alphabetic if all characters in the string are alphabetic and there
| is at least one character in the string.
|
| isascii(self, /)
| Return True if all characters in the string are ASCII, False otherwise.
|
| ASCII characters have code points in the range U+0000-U+007F.
| Empty string is ASCII too.
|
| isdecimal(self, /)
| Return True if the string is a decimal string, False otherwise.
|
| A string is a decimal string if all characters in the string are decimal and
| there is at least one character in the string.
|
| isdigit(self, /)
| Return True if the string is a digit string, False otherwise.
|
| A string is a digit string if all characters in the string are digits and there
| is at least one character in the string.
|
| isidentifier(self, /)
| Return True if the string is a valid Python identifier, False otherwise.
|
| Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
| such as "def" or "class".
|
| islower(self, /)
| Return True if the string is a lowercase string, False otherwise.
|
| A string is lowercase if all cased characters in the string are lowercase and
| there is at least one cased character in the string.
|
| isnumeric(self, /)
| Return True if the string is a numeric string, False otherwise.
|
| A string is numeric if all characters in the string are numeric and there is at
| least one character in the string.
|
| isprintable(self, /)
| Return True if the string is printable, False otherwise.
|
| A string is printable if all of its characters are considered printable in
| repr() or if it is empty.
|
| isspace(self, /)
| Return True if the string is a whitespace string, False otherwise.
|
| A string is whitespace if all characters in the string are whitespace and there
| is at least one character in the string.
|
| istitle(self, /)
| Return True if the string is a title-cased string, False otherwise.
|
| In a title-cased string, upper- and title-case characters may only
| follow uncased characters and lowercase characters only cased ones.
|
| isupper(self, /)
| Return True if the string is an uppercase string, False otherwise.
|
| A string is uppercase if all cased characters in the string are uppercase and
| there is at least one cased character in the string.
|
| join(self, iterable, /)
| Concatenate any number of strings.
|
| The string whose method is called is inserted in between each given string.
| The result is returned as a new string.
|
| Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
| ljust(self, width, fillchar=' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| lower(self, /)
| Return a copy of the string converted to lowercase.
|
| lstrip(self, chars=None, /)
| Return a copy of the string with leading whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| partition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original string
| and two empty strings.
|
| removeprefix(self, prefix, /)
| Return a str with the given prefix string removed if present.
|
| If the string starts with the prefix string, return string[len(prefix):].
| Otherwise, return a copy of the original string.
|
| removesuffix(self, suffix, /)
| Return a str with the given suffix string removed if present.
|
| If the string ends with the suffix string and that suffix is not empty,
| return string[:-len(suffix)]. Otherwise, return a copy of the original
| string.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| S.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| S.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| rjust(self, width, fillchar=' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| rpartition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty strings
| and the original string.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the end of the string and works to the front.
|
| rstrip(self, chars=None, /)
| Return a copy of the string with trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the front of the string and works to the end.
|
| Note, str.split() is mainly useful for data that has been intentionally
| delimited. With natural text that includes punctuation, consider using
| the regular expression module.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the string, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.
|
| strip(self, chars=None, /)
| Return a copy of the string with leading and trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| swapcase(self, /)
| Convert uppercase characters to lowercase and lowercase characters to uppercase.
|
| title(self, /)
| Return a version of the string where each word is titlecased.
|
| More specifically, words start with uppercased characters and all remaining
| cased characters have lower case.
|
| translate(self, table, /)
| Replace each character in the string using the given translation table.
|
| table
| Translation table, which must be a mapping of Unicode ordinals to
| Unicode ordinals, strings, or None.
|
| The table must implement lookup/indexing via __getitem__, for instance a
| dictionary or list. If this operation raises LookupError, the character is
| left untouched. Characters mapped to None are deleted.
|
| upper(self, /)
| Return a copy of the string converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The string is never truncated.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.str:
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class FontFlags(enum.IntFlag)
| FontFlags(*values)
|
| A class defining font flags in PDF document font descriptor resources.
|
| Defined in table 121 of the PDF 2.0 reference.
|
| Method resolution order:
| FontFlags
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ALL_CAP = <FontFlags.ALL_CAP: 65536>
|
| FIXED_PITCH = <FontFlags.FIXED_PITCH: 1>
|
| FORCE_BOLD = <FontFlags.FORCE_BOLD: 262144>
|
| ITALIC = <FontFlags.ITALIC: 64>
|
| NONSYMBOLIC = <FontFlags.NONSYMBOLIC: 32>
|
| SCRIPT = <FontFlags.SCRIPT: 8>
|
| SERIF = <FontFlags.SERIF: 2>
|
| SMALL_CAP = <FontFlags.SMALL_CAP: 131072>
|
| SYMBOLIC = <FontFlags.SYMBOLIC: 4>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class GoToActionArguments(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| D = '/D'
|
| S = '/S'
|
| SD = '/SD'
class GraphicsStateParameters(builtins.object)
| Table 58 – Entries in a Graphics State Parameter Dictionary
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AIS = '/AIS'
|
| BG = '/BG'
|
| BG2 = '/BG2'
|
| BM = '/BM'
|
| CA = '/CA'
|
| D = '/D'
|
| FL = '/FL'
|
| FONT = '/Font'
|
| HT = '/HT'
|
| LC = '/LC'
|
| LJ = '/LJ'
|
| LW = '/LW'
|
| ML = '/ML'
|
| OP = '/OP'
|
| OPM = '/OPM'
|
| RI = '/RI'
|
| SA = '/SA'
|
| SM = '/SM'
|
| S_MASK = '/SMask'
|
| TK = '/TK'
|
| TR = '/TR'
|
| TR2 = '/TR2'
|
| TYPE = '/Type'
|
| UCR = '/UCR'
|
| UCR2 = '/UCR2'
|
| ca = '/ca'
|
| op = '/op'
class ImageAttributes(builtins.object)
| §11.6.5 of the 1.7 and 2.0 references.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BITS_PER_COMPONENT = '/BitsPerComponent'
|
| COLOR_SPACE = '/ColorSpace'
|
| DECODE = '/Decode'
|
| HEIGHT = '/Height'
|
| IMAGE_MASK = '/ImageMask'
|
| INTENT = '/Intent'
|
| INTERPOLATE = '/Interpolate'
|
| MASK = '/Mask'
|
| NAME = '/Name'
|
| SUBTYPE = '/Subtype'
|
| S_MASK = '/SMask'
|
| TYPE = '/Type'
|
| WIDTH = '/Width'
class ImageType(enum.IntFlag)
| ImageType(*values)
|
| Method resolution order:
| ImageType
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DRAWING_IMAGES = <ImageType.DRAWING_IMAGES: 4>
|
| INLINE_IMAGES = <ImageType.INLINE_IMAGES: 2>
|
| XOBJECT_IMAGES = <ImageType.XOBJECT_IMAGES: 1>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class InteractiveFormDictEntries(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CO = '/CO'
|
| DA = '/DA'
|
| DR = '/DR'
|
| Fields = '/Fields'
|
| NeedAppearances = '/NeedAppearances'
|
| Q = '/Q'
|
| SigFlags = '/SigFlags'
|
| XFA = '/XFA'
class LzwFilterParameters(builtins.object)
| Table 4.4.
| Table 8 in the 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BITS_PER_COMPONENT = '/BitsPerComponent'
|
| COLORS = '/Colors'
|
| COLUMNS = '/Columns'
|
| EARLY_CHANGE = '/EarlyChange'
|
| PREDICTOR = '/Predictor'
class OutlineFontFlag(enum.IntFlag)
| OutlineFontFlag(*values)
|
| A class used as an enumerable flag for formatting an outline font.
|
| Method resolution order:
| OutlineFontFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| bold = <OutlineFontFlag.bold: 2>
|
| italic = <OutlineFontFlag.italic: 1>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class PageAttributes(builtins.object)
| §7.7.3.3 of the 1.7 and 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AA = '/AA'
|
| AF = '/AF'
|
| ANNOTS = '/Annots'
|
| ARTBOX = '/ArtBox'
|
| B = '/B'
|
| BLEEDBOX = '/BleedBox'
|
| BOX_COLOR_INFO = '/BoxColorInfo'
|
| CONTENTS = '/Contents'
|
| CROPBOX = '/CropBox'
|
| DUR = '/Dur'
|
| D_PART = '/DPart'
|
| GROUP = '/Group'
|
| ID = '/ID'
|
| LAST_MODIFIED = '/LastModified'
|
| MEDIABOX = '/MediaBox'
|
| METADATA = '/Metadata'
|
| OUTPUT_INTENTS = '/OutputIntents'
|
| PARENT = '/Parent'
|
| PIECE_INFO = '/PieceInfo'
|
| PRES_STEPS = '/PresSteps'
|
| PZ = '/PZ'
|
| RESOURCES = '/Resources'
|
| ROTATE = '/Rotate'
|
| SEPARATION_INFO = '/SeparationInfo'
|
| STRUCT_PARENTS = '/StructParents'
|
| TABS = '/Tabs'
|
| TEMPLATE_INSTANTIATED = '/TemplateInstantiated'
|
| THUMB = '/Thumb'
|
| TRANS = '/Trans'
|
| TRIMBOX = '/TrimBox'
|
| TYPE = '/Type'
|
| USER_UNIT = '/UserUnit'
|
| VP = '/VP'
class PageLabelStyle(builtins.object)
| Table 8.10 in the 1.7 reference.
| Table 161 in the 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DECIMAL = '/D'
|
| LOWERCASE_LETTER = '/a'
|
| LOWERCASE_ROMAN = '/r'
|
| UPPERCASE_LETTER = '/A'
|
| UPPERCASE_ROMAN = '/R'
class PageLayouts(builtins.object)
| Page 84, PDF 1.4 reference.
| Page 115, PDF 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ONE_COLUMN = '/OneColumn'
|
| SINGLE_PAGE = '/SinglePage'
|
| TWO_COLUMN_LEFT = '/TwoColumnLeft'
|
| TWO_COLUMN_RIGHT = '/TwoColumnRight'
|
| TWO_PAGE_LEFT = '/TwoPageLeft'
|
| TWO_PAGE_RIGHT = '/TwoPageRight'
class PagesAttributes(builtins.object)
| §7.7.3.2 of the 1.7 and 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| COUNT = '/Count'
|
| KIDS = '/Kids'
|
| PARENT = '/Parent'
|
| TYPE = '/Type'
class Resources(builtins.object)
| Table 3.30 Entries in a resource dictionary.
| Table 34 in the 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| COLOR_SPACE = '/ColorSpace'
|
| EXT_G_STATE = '/ExtGState'
|
| FONT = '/Font'
|
| PATTERN = '/Pattern'
|
| PROC_SET = '/ProcSet'
|
| PROPERTIES = '/Properties'
|
| SHADING = '/Shading'
|
| XOBJECT = '/XObject'
class StrEnum(builtins.str, enum.Enum)
| StrEnum(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)
|
| Method resolution order:
| StrEnum
| builtins.str
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec) from enum.Enum
| Default object formatter.
|
| Return str(self) if format_spec is empty. Raise TypeError otherwise.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__(self) -> str
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.str:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __sizeof__(self, /)
| Return the size of the string in memory, in bytes.
|
| capitalize(self, /)
| Return a capitalized version of the string.
|
| More specifically, make the first character have upper case and the rest lower
| case.
|
| casefold(self, /)
| Return a version of the string suitable for caseless comparisons.
|
| center(self, width, fillchar=' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| count(...)
| S.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are
| interpreted as in slice notation.
|
| encode(self, /, encoding='utf-8', errors='strict')
| Encode the string using the codec registered for encoding.
|
| encoding
| The encoding in which to encode the string.
| errors
| The error handling scheme to use for encoding errors.
| The default is 'strict' meaning that encoding errors raise a
| UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
| 'xmlcharrefreplace' as well as any other name registered with
| codecs.register_error that can handle UnicodeEncodeErrors.
|
| endswith(...)
| S.endswith(suffix[, start[, end]]) -> bool
|
| Return True if S ends with the specified suffix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| suffix can also be a tuple of strings to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| S.find(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| format(...)
| S.format(*args, **kwargs) -> str
|
| Return a formatted version of S, using substitutions from args and kwargs.
| The substitutions are identified by braces ('{' and '}').
|
| format_map(...)
| S.format_map(mapping) -> str
|
| Return a formatted version of S, using substitutions from mapping.
| The substitutions are identified by braces ('{' and '}').
|
| index(...)
| S.index(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| isalnum(self, /)
| Return True if the string is an alpha-numeric string, False otherwise.
|
| A string is alpha-numeric if all characters in the string are alpha-numeric and
| there is at least one character in the string.
|
| isalpha(self, /)
| Return True if the string is an alphabetic string, False otherwise.
|
| A string is alphabetic if all characters in the string are alphabetic and there
| is at least one character in the string.
|
| isascii(self, /)
| Return True if all characters in the string are ASCII, False otherwise.
|
| ASCII characters have code points in the range U+0000-U+007F.
| Empty string is ASCII too.
|
| isdecimal(self, /)
| Return True if the string is a decimal string, False otherwise.
|
| A string is a decimal string if all characters in the string are decimal and
| there is at least one character in the string.
|
| isdigit(self, /)
| Return True if the string is a digit string, False otherwise.
|
| A string is a digit string if all characters in the string are digits and there
| is at least one character in the string.
|
| isidentifier(self, /)
| Return True if the string is a valid Python identifier, False otherwise.
|
| Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
| such as "def" or "class".
|
| islower(self, /)
| Return True if the string is a lowercase string, False otherwise.
|
| A string is lowercase if all cased characters in the string are lowercase and
| there is at least one cased character in the string.
|
| isnumeric(self, /)
| Return True if the string is a numeric string, False otherwise.
|
| A string is numeric if all characters in the string are numeric and there is at
| least one character in the string.
|
| isprintable(self, /)
| Return True if the string is printable, False otherwise.
|
| A string is printable if all of its characters are considered printable in
| repr() or if it is empty.
|
| isspace(self, /)
| Return True if the string is a whitespace string, False otherwise.
|
| A string is whitespace if all characters in the string are whitespace and there
| is at least one character in the string.
|
| istitle(self, /)
| Return True if the string is a title-cased string, False otherwise.
|
| In a title-cased string, upper- and title-case characters may only
| follow uncased characters and lowercase characters only cased ones.
|
| isupper(self, /)
| Return True if the string is an uppercase string, False otherwise.
|
| A string is uppercase if all cased characters in the string are uppercase and
| there is at least one cased character in the string.
|
| join(self, iterable, /)
| Concatenate any number of strings.
|
| The string whose method is called is inserted in between each given string.
| The result is returned as a new string.
|
| Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
| ljust(self, width, fillchar=' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| lower(self, /)
| Return a copy of the string converted to lowercase.
|
| lstrip(self, chars=None, /)
| Return a copy of the string with leading whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| partition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original string
| and two empty strings.
|
| removeprefix(self, prefix, /)
| Return a str with the given prefix string removed if present.
|
| If the string starts with the prefix string, return string[len(prefix):].
| Otherwise, return a copy of the original string.
|
| removesuffix(self, suffix, /)
| Return a str with the given suffix string removed if present.
|
| If the string ends with the suffix string and that suffix is not empty,
| return string[:-len(suffix)]. Otherwise, return a copy of the original
| string.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| S.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| S.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| rjust(self, width, fillchar=' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| rpartition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty strings
| and the original string.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the end of the string and works to the front.
|
| rstrip(self, chars=None, /)
| Return a copy of the string with trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the front of the string and works to the end.
|
| Note, str.split() is mainly useful for data that has been intentionally
| delimited. With natural text that includes punctuation, consider using
| the regular expression module.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the string, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.
|
| strip(self, chars=None, /)
| Return a copy of the string with leading and trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| swapcase(self, /)
| Convert uppercase characters to lowercase and lowercase characters to uppercase.
|
| title(self, /)
| Return a version of the string where each word is titlecased.
|
| More specifically, words start with uppercased characters and all remaining
| cased characters have lower case.
|
| translate(self, table, /)
| Replace each character in the string using the given translation table.
|
| table
| Translation table, which must be a mapping of Unicode ordinals to
| Unicode ordinals, strings, or None.
|
| The table must implement lookup/indexing via __getitem__, for instance a
| dictionary or list. If this operation raises LookupError, the character is
| left untouched. Characters mapped to None are deleted.
|
| upper(self, /)
| Return a copy of the string converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The string is never truncated.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.str:
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class StreamAttributes(builtins.object)
| Table 4.2.
| Table 5 in the 2.0 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DECODE_PARMS = '/DecodeParms'
|
| FILTER = '/Filter'
|
| LENGTH = '/Length'
class TrailerKeys(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ENCRYPT = '/Encrypt'
|
| ID = '/ID'
|
| INFO = '/Info'
|
| PREV = '/Prev'
|
| ROOT = '/Root'
|
| SIZE = '/Size'
class TypArguments(builtins.object)
| Table 8.2 of the PDF 1.7 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BOTTOM = '/Bottom'
|
| LEFT = '/Left'
|
| RIGHT = '/Right'
|
| TOP = '/Top'
class TypFitArguments(builtins.object)
| Table 8.2 of the PDF 1.7 reference.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| FIT = '/Fit'
|
| FIT_B = '/FitB'
|
| FIT_BH = '/FitBH'
|
| FIT_BV = '/FitBV'
|
| FIT_H = '/FitH'
|
| FIT_R = '/FitR'
|
| FIT_V = '/FitV'
|
| XYZ = '/XYZ'
class UserAccessPermissions(enum.IntFlag)
| UserAccessPermissions(*values)
|
| Table 3.20 User access permissions.
| Table 22 of the 2.0 manual.
|
| Method resolution order:
| UserAccessPermissions
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ADD_OR_MODIFY = <UserAccessPermissions.ADD_OR_MODIFY: 32>
|
| ASSEMBLE_DOC = <UserAccessPermissions.ASSEMBLE_DOC: 1024>
|
| EXTRACT = <UserAccessPermissions.EXTRACT: 16>
|
| EXTRACT_TEXT_AND_GRAPHICS = <UserAccessPermissions.EXTRACT_TEXT_AND_GR...
|
| FILL_FORM_FIELDS = <UserAccessPermissions.FILL_FORM_FIELDS: 256>
|
| MODIFY = <UserAccessPermissions.MODIFY: 8>
|
| PRINT = <UserAccessPermissions.PRINT: 4>
|
| PRINT_TO_REPRESENTATION = <UserAccessPermissions.PRINT_TO_REPRESENTATI...
|
| R1 = <UserAccessPermissions.R1: 1>
|
| R13 = <UserAccessPermissions.R13: 4096>
|
| R14 = <UserAccessPermissions.R14: 8192>
|
| R15 = <UserAccessPermissions.R15: 16384>
|
| R16 = <UserAccessPermissions.R16: 32768>
|
| R17 = <UserAccessPermissions.R17: 65536>
|
| R18 = <UserAccessPermissions.R18: 131072>
|
| R19 = <UserAccessPermissions.R19: 262144>
|
| R2 = <UserAccessPermissions.R2: 2>
|
| R20 = <UserAccessPermissions.R20: 524288>
|
| R21 = <UserAccessPermissions.R21: 1048576>
|
| R22 = <UserAccessPermissions.R22: 2097152>
|
| R23 = <UserAccessPermissions.R23: 4194304>
|
| R24 = <UserAccessPermissions.R24: 8388608>
|
| R25 = <UserAccessPermissions.R25: 16777216>
|
| R26 = <UserAccessPermissions.R26: 33554432>
|
| R27 = <UserAccessPermissions.R27: 67108864>
|
| R28 = <UserAccessPermissions.R28: 134217728>
|
| R29 = <UserAccessPermissions.R29: 268435456>
|
| R30 = <UserAccessPermissions.R30: 536870912>
|
| R31 = <UserAccessPermissions.R31: 1073741824>
|
| R32 = <UserAccessPermissions.R32: 2147483648>
|
| R7 = <UserAccessPermissions.R7: 64>
|
| R8 = <UserAccessPermissions.R8: 128>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
DATA
PDF_KEYS = (<class 'pypdf.constants.AnnotationDictionaryAttributes'>, ...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\constants.py
pypdf.crypt_provider
Python Library Documentation: tuple object class tuple(object) | tuple(iterable=(), /) | | Built-in immutable sequence. | | If no argument is given, the constructor returns an empty tuple. | If iterable is specified the tuple is initialized from iterable's items. | | If the argument is a tuple, the return value is the same object. | | Built-in subclasses: | asyncgen_hooks | UnraisableHookArgs | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getitem__(self, key, /) | Return self[key]. | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __iter__(self, /) | Implement iter(self). | | __le__(self, value, /) | Return self<=value. | | __len__(self, /) | Return len(self). | | __lt__(self, value, /) | Return self<value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | __rmul__(self, value, /) | Return value*self. | | count(self, value, /) | Return number of occurrences of value. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature.
pypdf.errors
Python Library Documentation: module pypdf.errors in pypdf
NAME
pypdf.errors - All errors/exceptions pypdf raises and all of the warnings it uses.
DESCRIPTION
Please note that broken PDF files might cause other Exceptions.
CLASSES
builtins.Exception(builtins.BaseException)
DependencyError
DeprecationError
PyPdfError
EmptyImageDataError
LimitReachedError
PageSizeNotDefinedError
ParseError
PdfReadError
EmptyFileError
FileNotDecryptedError
WrongPasswordError
PdfStreamError
XmpDocumentError(PyPdfError, builtins.RuntimeError)
builtins.UserWarning(builtins.Warning)
PdfReadWarning
class DependencyError(builtins.Exception)
| Raised when a required dependency (a library or module that pypdf depends on)
| is not available or cannot be imported.
|
| Method resolution order:
| DependencyError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class DeprecationError(builtins.Exception)
| Raised when a deprecated feature is used.
|
| Method resolution order:
| DeprecationError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class EmptyFileError(PdfReadError)
| Raised when a PDF file is empty or has no content.
|
| Method resolution order:
| EmptyFileError
| PdfReadError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class EmptyImageDataError(PyPdfError)
| Raised when trying to process an image that has no data.
|
| Method resolution order:
| EmptyImageDataError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FileNotDecryptedError(PdfReadError)
| Raised when a PDF file that has been encrypted
| (meaning it requires a password to be accessed) has not been successfully
| decrypted.
|
| Method resolution order:
| FileNotDecryptedError
| PdfReadError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class LimitReachedError(PyPdfError)
| Raised when a limit is reached.
|
| Method resolution order:
| LimitReachedError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PageSizeNotDefinedError(PyPdfError)
| Raised when the page size of a PDF document is not defined.
|
| Method resolution order:
| PageSizeNotDefinedError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ParseError(PyPdfError)
| Raised when there is an issue parsing (analyzing and understanding the
| structure and meaning of) a PDF file.
|
| Method resolution order:
| ParseError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PdfReadError(PyPdfError)
| Raised when there is an issue reading a PDF file.
|
| Method resolution order:
| PdfReadError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PdfReadWarning(builtins.UserWarning)
| Issued when there is a potential issue reading a PDF file, but it can still be read.
|
| Method resolution order:
| PdfReadWarning
| builtins.UserWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.UserWarning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.UserWarning:
|
| __new__(*args, **kwargs) class method of builtins.UserWarning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PdfStreamError(PdfReadError)
| Raised when there is an issue reading the stream of data in a PDF file.
|
| Method resolution order:
| PdfStreamError
| PdfReadError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyPdfError(builtins.Exception)
| Base class for all exceptions raised by pypdf.
|
| Method resolution order:
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class WrongPasswordError(FileNotDecryptedError)
| Raised when the wrong password is used to try to decrypt an encrypted PDF file.
|
| Method resolution order:
| WrongPasswordError
| FileNotDecryptedError
| PdfReadError
| PyPdfError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class XmpDocumentError(PyPdfError, builtins.RuntimeError)
| Raised when the XMP XML document context is invalid or missing.
|
| Method resolution order:
| XmpDocumentError
| PyPdfError
| builtins.RuntimeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyPdfError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.RuntimeError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.RuntimeError:
|
| __new__(*args, **kwargs) class method of builtins.RuntimeError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
DATA
STREAM_TRUNCATED_PREMATURELY = 'Stream has ended unexpectedly'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\errors.py
pypdf.filters
Python Library Documentation: module pypdf.filters in pypdf
NAME
pypdf.filters - Implementation of stream filters; §7.4 Filters of the PDF 2.0 specification.
DESCRIPTION
§8.9.7 Inline images of the PDF 2.0 specification has abbreviations that can be
used for the names of filters in an inline image object.
CLASSES
builtins.object
ASCII85Decode
ASCIIHexDecode
CCITTFaxDecode
CCITTParameters
DCTDecode
FlateDecode
JBIG2Decode
JPXDecode
LZWDecode
RunLengthDecode
class ASCII85Decode(builtins.object)
| Decodes string ASCII85-encoded data into a byte format.
|
| Static methods defined here:
|
| decode(data: Union[str, bytes], decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decode an Ascii85 encoded data stream.
|
| Args:
| data: ``bytes`` or ``str`` text to decode.
| decode_parms: this filter does not use parameters.
|
| Returns:
| decoded data.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ASCIIHexDecode(builtins.object)
| The ASCIIHexDecode filter decodes data that has been encoded in ASCII
| hexadecimal form into a base-7 ASCII format.
|
| Static methods defined here:
|
| decode(data: Union[str, bytes], decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decode an ASCII-Hex encoded data stream.
|
| Args:
| data: a str sequence of hexadecimal-encoded values to be
| converted into a base-7 ASCII string
| decode_parms: this filter does not use parameters.
|
| Returns:
| A string conversion in base-7 ASCII, where each of its values
| v is such that 0 <= ord(v) <= 127.
|
| Raises:
| PdfStreamError:
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class CCITTFaxDecode(builtins.object)
| §7.4.6, CCITTFaxDecode filter (ISO 32000).
|
| Either Group 3 or Group 4 CCITT facsimile (fax) encoding.
| CCITT encoding is bit-oriented, not byte-oriented.
|
| §7.4.6, optional parameters for the CCITTFaxDecode filter.
|
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, height: int = 0, **kwargs: Any) -> bytes
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class CCITTParameters(builtins.object)
| CCITTParameters(K: int = 0, columns: int = 1728, rows: int = 0, EndOfLine: Optional[bool] = False, EncodedByteAlign: Optional[bool] = False, EndOfBlock: Optional[bool] = True, BlackIs1: bool = False, DamagedRowsBeforeError: Optional[int] = 0) -> None
|
| §7.4.6, optional parameters for the CCITTFaxDecode filter.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __init__(self, K: int = 0, columns: int = 1728, rows: int = 0, EndOfLine: Optional[bool] = False, EncodedByteAlign: Optional[bool] = False, EndOfBlock: Optional[bool] = True, BlackIs1: bool = False, DamagedRowsBeforeError: Optional[int] = 0) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| group
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BlackIs1 = False
|
| DamagedRowsBeforeError = 0
|
| EncodedByteAlign = False
|
| EndOfBlock = True
|
| EndOfLine = False
|
| K = 0
|
| __annotations__ = {'BlackIs1': <class 'bool'>, 'DamagedRowsBeforeError...
|
| __dataclass_fields__ = {'BlackIs1': Field(name='BlackIs1',type=<class ...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __hash__ = None
|
| __match_args__ = ('K', 'columns', 'rows', 'EndOfLine', 'EncodedByteAli...
|
| columns = 1728
|
| rows = 0
class DCTDecode(builtins.object)
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decompresses data encoded using a DCT (discrete cosine transform)
| technique based on the JPEG standard (IS0/IEC 10918),
| reproducing image sample data that approximates the original data.
|
| Args:
| data: text to decode.
| decode_parms: this filter does not use parameters.
|
| Returns:
| decoded data.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class FlateDecode(builtins.object)
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decode data which is flate-encoded.
|
| Args:
| data: Flate-encoded data.
| decode_parms: Additional decoding parameters.
|
| Returns:
| The flate-decoded data.
|
| Raises:
| PdfReadError: Unsupported parameters have been found.
|
| encode(data: bytes, level: int = -1) -> bytes
| Compress the input data using zlib.
|
| Args:
| data: The data to be compressed.
| level: See https://docs.python.org/3/library/zlib.html#zlib.compress
|
| Returns:
| The compressed data.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class JBIG2Decode(builtins.object)
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class JPXDecode(builtins.object)
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decompresses data encoded using the wavelet-based JPEG 2000 standard,
| reproducing the original image data.
|
| Args:
| data: text to decode.
| decode_parms: this filter does not use parameters.
|
| Returns:
| decoded data.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LZWDecode(builtins.object)
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decode an LZW encoded data stream.
|
| Args:
| data: ``bytes`` or ``str`` text to decode.
| decode_parms: a dictionary of parameter values.
|
| Returns:
| decoded data.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| Decoder = <class 'pypdf.filters.LZWDecode.Decoder'>
class RunLengthDecode(builtins.object)
| The RunLengthDecode filter decodes data that has been encoded in a
| simple byte-oriented format based on run length.
| The encoded data is a sequence of runs, where each run consists of
| a length byte followed by 1 to 128 bytes of data. If the length byte is
| in the range 0 to 127,
| the following length + 1 (1 to 128) bytes are copied literally during
| decompression.
| If length is in the range 129 to 255, the following single byte is to be
| copied 257 − length (2 to 128) times during decompression. A length value
| of 128 denotes EOD.
|
| Static methods defined here:
|
| decode(data: bytes, decode_parms: Optional[pypdf.generic._data_structures.DictionaryObject] = None, **kwargs: Any) -> bytes
| Decode a run length encoded data stream.
|
| Args:
| data: a bytes sequence of length/data
| decode_parms: this filter does not use parameters.
|
| Returns:
| A bytes decompressed sequence.
|
| Raises:
| PdfStreamError:
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
CCITParameters = __create_old_class_instance(K: int = 0, columns: int = 0, rows: int = 0) -> NoReturn
decode_stream_data(stream: pypdf.generic._data_structures.StreamObject) -> bytes
Decode the stream data based on the specified filters.
This function decodes the stream data using the filters provided in the
stream.
Args:
stream: The input stream object containing the data and filters.
Returns:
The decoded stream data.
Raises:
NotImplementedError: If an unsupported filter type is encountered.
decompress(data: bytes) -> bytes
Decompress the given data using zlib.
Attempts to decompress the input data using zlib.
If the decompression fails due to a zlib error, it falls back
to using a decompression object with a larger window size.
Please note that the output length is limited to avoid memory
issues. If you need to process larger content streams, consider
adapting ``pypdf.filters.ZLIB_MAX_OUTPUT_LENGTH``. In case you
are only dealing with trusted inputs and/or want to disable these
limits, set the value to `0`.
Args:
data: The input data to be decompressed.
Returns:
The decompressed data.
DATA
FLATE_MAX_BUFFER_SIZE = 75000000
FLATE_MAX_COLUMNS = 250000
FLATE_MAX_ROW_LENGTH = 4000000
JBIG2DEC_BINARY = None
JBIG2_MAX_OUTPUT_LENGTH = 75000000
LZW_MAX_OUTPUT_LENGTH = 75000000
MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH = 75000000
MAX_DECLARED_STREAM_LENGTH = 75000000
NoReturn = typing.NoReturn
Special type indicating functions that never return.
Example::
from typing import NoReturn
def stop() -> NoReturn:
raise Exception('no way')
NoReturn can also be used as a bottom type, a type that
has no values. Starting in Python 3.11, the Never type should
be used for this concept instead. Type checkers should treat the two
equivalently.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
RUN_LENGTH_MAX_OUTPUT_LENGTH = 75000000
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
WHITESPACES_AS_BYTES = b'\x00\t\n\x0c\r '
ZLIB_MAX_OUTPUT_LENGTH = 75000000
ZLIB_MAX_RECOVERY_INPUT_LENGTH = 5000000
__author_email__ = 'biziqe@mathieu.fenniak.net'
AUTHOR
Mathieu Fenniak
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\filters.py
pypdf.generic
Python Library Documentation: package pypdf.generic in pypdf
NAME
pypdf.generic - Implementation of generic PDF objects (dictionary, number, string, ...).
PACKAGE CONTENTS
_appearance_stream
_base
_data_structures
_files
_fit
_image_inline
_image_xobject
_link
_outline
_rectangle
_utils
_viewerpref
CLASSES
builtins.bytes(builtins.object)
pypdf.generic._base.ByteStringObject(builtins.bytes, pypdf.generic._base.PdfObject)
builtins.dict(builtins.object)
pypdf.generic._data_structures.DictionaryObject(builtins.dict, pypdf.generic._base.PdfObject)
pypdf.generic._data_structures.StreamObject
pypdf.generic._data_structures.DecodedStreamObject
pypdf.generic._data_structures.ContentStream
pypdf.generic._data_structures.EncodedStreamObject
pypdf.generic._data_structures.TreeObject
pypdf.generic._data_structures.Destination
pypdf.generic._outline.OutlineItem
pypdf.generic._data_structures.Field
pypdf.generic._viewerpref.ViewerPreferences
builtins.float(builtins.object)
pypdf.generic._base.FloatObject(builtins.float, pypdf.generic._base.PdfObject)
builtins.int(builtins.object)
pypdf.generic._base.NumberObject(builtins.int, pypdf.generic._base.PdfObject)
builtins.list(builtins.object)
pypdf.generic._data_structures.ArrayObject(builtins.list, pypdf.generic._base.PdfObject)
pypdf.generic._rectangle.RectangleObject
builtins.object
pypdf.generic._files.EmbeddedFile
pypdf.generic._fit.Fit
pypdf.generic._link.DirectReferenceLink
pypdf.generic._link.NamedReferenceLink
builtins.str(builtins.object)
pypdf.generic._base.NameObject(builtins.str, pypdf.generic._base.PdfObject)
pypdf.generic._base.TextStringObject(builtins.str, pypdf.generic._base.PdfObject)
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
pypdf.constants.OutlineFontFlag
pypdf._protocols.PdfObjectProtocol(typing.Protocol)
pypdf.generic._base.PdfObject
pypdf.generic._base.BooleanObject
pypdf.generic._base.ByteStringObject(builtins.bytes, pypdf.generic._base.PdfObject)
pypdf.generic._base.FloatObject(builtins.float, pypdf.generic._base.PdfObject)
pypdf.generic._base.IndirectObject
pypdf.generic._base.NameObject(builtins.str, pypdf.generic._base.PdfObject)
pypdf.generic._base.NullObject
pypdf.generic._base.NumberObject(builtins.int, pypdf.generic._base.PdfObject)
pypdf.generic._base.TextStringObject(builtins.str, pypdf.generic._base.PdfObject)
pypdf.generic._data_structures.ArrayObject(builtins.list, pypdf.generic._base.PdfObject)
pypdf.generic._rectangle.RectangleObject
pypdf.generic._data_structures.DictionaryObject(builtins.dict, pypdf.generic._base.PdfObject)
pypdf.generic._data_structures.StreamObject
pypdf.generic._data_structures.DecodedStreamObject
pypdf.generic._data_structures.ContentStream
pypdf.generic._data_structures.EncodedStreamObject
pypdf.generic._data_structures.TreeObject
pypdf.generic._data_structures.Destination
pypdf.generic._outline.OutlineItem
pypdf.generic._data_structures.Field
pypdf.generic._viewerpref.ViewerPreferences
class ArrayObject(builtins.list, pypdf.generic._base.PdfObject)
| ArrayObject(iterable=(), /)
|
| Method resolution order:
| ArrayObject
| builtins.list
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __add__(self, lst: Any) -> 'ArrayObject'
| Allow extension by adding list or add one element only
|
| Args:
| lst: any list, tuples are extended the list.
| other types(numbers,...) will be appended.
| if str is passed it will be converted into TextStringObject
| or NameObject (if starting with "/")
| if bytes is passed it will be converted into ByteStringObject
|
| Returns:
| ArrayObject with all elements
|
| __iadd__(self, lst: Any) -> Self
| Allow extension by adding list or add one element only
|
| Args:
| lst: any list, tuples are extended the list.
| other types(numbers,...) will be appended.
| if str is passed it will be converted into TextStringObject
| or NameObject (if starting with "/")
| if bytes is passed it will be converted into ByteStringObject
|
| __isub__(self, lst: Any) -> Self
| Allow to remove items
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'ArrayObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| items(self) -> collections.abc.Iterable[typing.Any]
| Emulate DictionaryObject.items for a list (index, object).
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'ArrayObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'ArrayObject'
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __orig_bases__ = (list[typing.Any], <class 'pypdf.generic._base.PdfObj...
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.list:
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, index, /)
| Return self[index].
|
| __gt__(self, value, /)
| Return self>value.
|
| __imul__(self, value, /)
| Implement self*=value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the list.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(self, /)
| Return the size of the list in memory, in bytes.
|
| append(self, object, /)
| Append object to the end of the list.
|
| clear(self, /)
| Remove all items from list.
|
| copy(self, /)
| Return a shallow copy of the list.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| extend(self, iterable, /)
| Extend list by appending elements from the iterable.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| insert(self, index, object, /)
| Insert object before index.
|
| pop(self, index=-1, /)
| Remove and return item at index (default last).
|
| Raises IndexError if list is empty or index is out of range.
|
| remove(self, value, /)
| Remove first occurrence of value.
|
| Raises ValueError if the value is not present.
|
| reverse(self, /)
| Reverse *IN PLACE*.
|
| sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
| order of two equal elements is maintained).
|
| If a key function is given, apply it once to each list item and sort them,
| ascending or descending, according to their function values.
|
| The reverse flag can be set to sort in descending order.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.list:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.list:
|
| __new__(*args, **kwargs) class method of builtins.list
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.list:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class BooleanObject(PdfObject)
| BooleanObject(value: Any) -> None
|
| Method resolution order:
| BooleanObject
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __eq__(self, o: object, /) -> bool
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __init__(self, value: Any) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> str
| Return repr(self).
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'BooleanObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any]) -> 'BooleanObject'
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'value': <class 'bool'>}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| Function to initialize subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class ByteStringObject(builtins.bytes, PdfObject)
| ByteStringObject(*args, **kwargs)
|
| Represents a string object where the text encoding could not be determined.
|
| This occurs quite often, as the PDF spec doesn't provide an alternate way to
| represent strings -- for example, the encryption data stored in files (like
| /O) is clearly not text, but is still stored in a "String" object.
|
| Method resolution order:
| ByteStringObject
| builtins.bytes
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __str__(self) -> str
| Return str(self).
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'ByteStringObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| original_bytes
| For compatibility with TextStringObject.original_bytes.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.bytes:
|
| __add__(self, value, /)
| Return self+value.
|
| __buffer__(self, flags, /)
| Return a buffer object that exposes the underlying memory of the object.
|
| __bytes__(self, /)
| Convert this value to exact type bytes.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| capitalize(...)
| B.capitalize() -> copy of B
|
| Return a copy of B with only its first character capitalized (ASCII)
| and the rest lower-cased.
|
| center(self, width, fillchar=b' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character.
|
| count(...)
| B.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of subsection sub in
| bytes B[start:end]. Optional arguments start and end are interpreted
| as in slice notation.
|
| decode(self, /, encoding='utf-8', errors='strict')
| Decode the bytes using the codec registered for encoding.
|
| encoding
| The encoding with which to decode the bytes.
| errors
| The error handling scheme to use for the handling of decoding errors.
| The default is 'strict' meaning that decoding errors raise a
| UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
| as well as any other name registered with codecs.register_error that
| can handle UnicodeDecodeErrors.
|
| endswith(...)
| B.endswith(suffix[, start[, end]]) -> bool
|
| Return True if B ends with the specified suffix, False otherwise.
| With optional start, test B beginning at that position.
| With optional end, stop comparing B at that position.
| suffix can also be a tuple of bytes to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| B.find(sub[, start[, end]]) -> int
|
| Return the lowest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| hex(...)
| Create a string of hexadecimal numbers from a bytes object.
|
| sep
| An optional single character or byte to separate hex bytes.
| bytes_per_sep
| How many bytes between separators. Positive values count from the
| right, negative values count from the left.
|
| Example:
| >>> value = b'\xb9\x01\xef'
| >>> value.hex()
| 'b901ef'
| >>> value.hex(':')
| 'b9:01:ef'
| >>> value.hex(':', 2)
| 'b9:01ef'
| >>> value.hex(':', -2)
| 'b901:ef'
|
| index(...)
| B.index(sub[, start[, end]]) -> int
|
| Return the lowest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the subsection is not found.
|
| isalnum(...)
| B.isalnum() -> bool
|
| Return True if all characters in B are alphanumeric
| and there is at least one character in B, False otherwise.
|
| isalpha(...)
| B.isalpha() -> bool
|
| Return True if all characters in B are alphabetic
| and there is at least one character in B, False otherwise.
|
| isascii(...)
| B.isascii() -> bool
|
| Return True if B is empty or all characters in B are ASCII,
| False otherwise.
|
| isdigit(...)
| B.isdigit() -> bool
|
| Return True if all characters in B are digits
| and there is at least one character in B, False otherwise.
|
| islower(...)
| B.islower() -> bool
|
| Return True if all cased characters in B are lowercase and there is
| at least one cased character in B, False otherwise.
|
| isspace(...)
| B.isspace() -> bool
|
| Return True if all characters in B are whitespace
| and there is at least one character in B, False otherwise.
|
| istitle(...)
| B.istitle() -> bool
|
| Return True if B is a titlecased string and there is at least one
| character in B, i.e. uppercase characters may only follow uncased
| characters and lowercase characters only cased ones. Return False
| otherwise.
|
| isupper(...)
| B.isupper() -> bool
|
| Return True if all cased characters in B are uppercase and there is
| at least one cased character in B, False otherwise.
|
| join(self, iterable_of_bytes, /)
| Concatenate any number of bytes objects.
|
| The bytes whose method is called is inserted in between each pair.
|
| The result is returned as a new bytes object.
|
| Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
|
| ljust(self, width, fillchar=b' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character.
|
| lower(...)
| B.lower() -> copy of B
|
| Return a copy of B with all ASCII characters converted to lowercase.
|
| lstrip(self, bytes=None, /)
| Strip leading bytes contained in the argument.
|
| If the argument is omitted or None, strip leading ASCII whitespace.
|
| partition(self, sep, /)
| Partition the bytes into three parts using the given separator.
|
| This will search for the separator sep in the bytes. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original bytes
| object and two empty bytes objects.
|
| removeprefix(self, prefix, /)
| Return a bytes object with the given prefix string removed if present.
|
| If the bytes starts with the prefix string, return bytes[len(prefix):].
| Otherwise, return a copy of the original bytes.
|
| removesuffix(self, suffix, /)
| Return a bytes object with the given suffix string removed if present.
|
| If the bytes ends with the suffix string and that suffix is not empty,
| return bytes[:-len(prefix)]. Otherwise, return a copy of the original
| bytes.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| B.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| B.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raise ValueError when the subsection is not found.
|
| rjust(self, width, fillchar=b' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character.
|
| rpartition(self, sep, /)
| Partition the bytes into three parts using the given separator.
|
| This will search for the separator sep in the bytes, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty bytes
| objects and the original bytes object.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the sections in the bytes, using sep as the delimiter.
|
| sep
| The delimiter according which to split the bytes.
| None (the default value) means split on ASCII whitespace characters
| (space, tab, return, newline, formfeed, vertical tab).
| maxsplit
| Maximum number of splits to do.
| -1 (the default value) means no limit.
|
| Splitting is done starting at the end of the bytes and working to the front.
|
| rstrip(self, bytes=None, /)
| Strip trailing bytes contained in the argument.
|
| If the argument is omitted or None, strip trailing ASCII whitespace.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the sections in the bytes, using sep as the delimiter.
|
| sep
| The delimiter according which to split the bytes.
| None (the default value) means split on ASCII whitespace characters
| (space, tab, return, newline, formfeed, vertical tab).
| maxsplit
| Maximum number of splits to do.
| -1 (the default value) means no limit.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the bytes, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| B.startswith(prefix[, start[, end]]) -> bool
|
| Return True if B starts with the specified prefix, False otherwise.
| With optional start, test B beginning at that position.
| With optional end, stop comparing B at that position.
| prefix can also be a tuple of bytes to try.
|
| strip(self, bytes=None, /)
| Strip leading and trailing bytes contained in the argument.
|
| If the argument is omitted or None, strip leading and trailing ASCII whitespace.
|
| swapcase(...)
| B.swapcase() -> copy of B
|
| Return a copy of B with uppercase ASCII characters converted
| to lowercase ASCII and vice versa.
|
| title(...)
| B.title() -> copy of B
|
| Return a titlecased version of B, i.e. ASCII words start with uppercase
| characters, all remaining cased characters have lowercase.
|
| translate(self, table, /, delete=b'')
| Return a copy with each character mapped by the given translation table.
|
| table
| Translation table, which must be a bytes object of length 256.
|
| All characters occurring in the optional argument delete are removed.
| The remaining characters are mapped through the given translation table.
|
| upper(...)
| B.upper() -> copy of B
|
| Return a copy of B with all ASCII characters converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The original string is never truncated.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.bytes:
|
| fromhex(string, /)
| Create a bytes object from a string of hexadecimal numbers.
|
| Spaces between two numbers are accepted.
| Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.bytes:
|
| __new__(*args, **kwargs) class method of builtins.bytes
| Create and return a new object. See help(type) for accurate signature.
|
| maketrans(frm, to, /)
| Return a translation table useable for the bytes or bytearray translate method.
|
| The returned table will be one where each byte in frm is mapped to the byte at
| the same position in to.
|
| The bytes objects frm and to must be of the same length.
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class ContentStream(DecodedStreamObject)
| ContentStream(stream: Any, pdf: Any, forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> None
|
| In order to be fast, this data structure can contain either:
|
| * raw data in ._data
| * parsed stream operations in ._operations.
|
| At any time, ContentStream object can either have both of those fields defined,
| or one field defined and the other set to None.
|
| These fields are "rebuilt" lazily, when accessed:
|
| * when .get_data() is called, if ._data is None, it is rebuilt from ._operations.
| * when .operations is called, if ._operations is None, it is rebuilt from ._data.
|
| Conversely, these fields can be invalidated:
|
| * when .set_data() is called, ._operations is set to None.
| * when .operations is set, ._data is set to None.
|
| Method resolution order:
| ContentStream
| DecodedStreamObject
| StreamObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, stream: Any, pdf: Any, forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'ContentStream'
| Clone object into pdf_dest.
|
| Args:
| pdf_dest:
| force_duplicate:
| ignore_fields:
|
| Returns:
| The cloned ContentStream
|
| get_data(self) -> bytes
| # This overrides the parent method
|
| isolate_graphics_state(self) -> None
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'ContentStream'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| set_data(self, data: bytes) -> None
| # This overrides the parent method
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
| # This overrides the parent method
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| operations
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from StreamObject:
|
| decode_as_image(self, pillow_parameters: Optional[dict[str, Any]] = None) -> Any
| Try to decode the stream object as an image
|
| Args:
| pillow_parameters: parameters provided to Pillow Image.save() method,
| cf. <https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save>
|
| Returns:
| a PIL image if proper decoding has been found
| Raises:
| Exception: Errors during decoding will be reported.
| It is recommended to catch exceptions to prevent
| stops in your program.
|
| flate_encode(self, level: int = -1) -> 'EncodedStreamObject'
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from StreamObject:
|
| initialize_from_dictionary(data: dict[str, typing.Any]) -> Union[ForwardRef('EncodedStreamObject'), ForwardRef('DecodedStreamObject')]
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| raw_get(self, key: Any) -> Any
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class DecodedStreamObject(StreamObject)
| DecodedStreamObject() -> None
|
| Method resolution order:
| DecodedStreamObject
| StreamObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from StreamObject:
|
| __init__(self) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| decode_as_image(self, pillow_parameters: Optional[dict[str, Any]] = None) -> Any
| Try to decode the stream object as an image
|
| Args:
| pillow_parameters: parameters provided to Pillow Image.save() method,
| cf. <https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save>
|
| Returns:
| a PIL image if proper decoding has been found
| Raises:
| Exception: Errors during decoding will be reported.
| It is recommended to catch exceptions to prevent
| stops in your program.
|
| flate_encode(self, level: int = -1) -> 'EncodedStreamObject'
|
| get_data(self) -> bytes
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'StreamObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| set_data(self, data: bytes) -> None
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from StreamObject:
|
| initialize_from_dictionary(data: dict[str, typing.Any]) -> Union[ForwardRef('EncodedStreamObject'), ForwardRef('DecodedStreamObject')]
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| raw_get(self, key: Any) -> Any
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class Destination(TreeObject)
| Destination(title: Union[str, bytes], page: Union[pypdf.generic._base.NumberObject, pypdf.generic._base.IndirectObject, pypdf.generic._base.NullObject, pypdf.generic._data_structures.DictionaryObject], fit: pypdf.generic._fit.Fit) -> None
|
| A class representing a destination within a PDF file.
|
| See section 12.3.2 of the PDF 2.0 reference.
|
| Args:
| title: Title of this destination.
| page: Reference to the page of this destination. Should
| be an instance of :class:`IndirectObject<pypdf.generic.IndirectObject>`.
| fit: How the destination is displayed.
|
| Raises:
| PdfReadError: If destination type is invalid.
|
| Method resolution order:
| Destination
| TreeObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, title: Union[str, bytes], page: Union[pypdf.generic._base.NumberObject, pypdf.generic._base.IndirectObject, pypdf.generic._base.NullObject, pypdf.generic._data_structures.DictionaryObject], fit: pypdf.generic._fit.Fit) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| bottom
| Read-only property accessing the bottom vertical coordinate.
|
| color
| Read-only property accessing the color in (R, G, B) with values 0.0-1.0.
|
| dest_array
|
| font_format
| Read-only property accessing the font type.
|
| 1=italic, 2=bold, 3=both
|
| left
| Read-only property accessing the left horizontal coordinate.
|
| outline_count
| Read-only property accessing the outline count.
|
| positive = expanded
| negative = collapsed
| absolute value = number of visible descendants at all levels
|
| page
| Read-only property accessing the IndirectObject of the destination page.
|
| right
| Read-only property accessing the right horizontal coordinate.
|
| title
| Read-only property accessing the destination title.
|
| top
| Read-only property accessing the top vertical coordinate.
|
| typ
| Read-only property accessing the destination type.
|
| zoom
| Read-only property accessing the zoom factor.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'node': typing.Optional[pypdf.generic._data_structu...
|
| __parameters__ = ()
|
| node = None
|
| ----------------------------------------------------------------------
| Methods inherited from TreeObject:
|
| __iter__(self) -> Any
| Implement iter(self).
|
| add_child(self, child: Any, pdf: pypdf._protocols.PdfWriterProtocol) -> None
|
| children(self) -> collections.abc.Iterable[typing.Any]
|
| empty_tree(self) -> None
|
| has_children(self) -> bool
|
| inc_parent_counter_default(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| inc_parent_counter_outline(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| insert_child(self, child: Any, before: Any, pdf: pypdf._protocols.PdfWriterProtocol, inc_parent_counter: Optional[Callable[..., Any]] = None) -> pypdf.generic._base.IndirectObject
|
| remove_child(self, child: Any) -> None
|
| remove_from_tree(self) -> None
| Remove the object from the tree it is in.
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class DictionaryObject(builtins.dict, pypdf.generic._base.PdfObject)
| Method resolution order:
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class DirectReferenceLink(builtins.object)
| DirectReferenceLink(reference: pypdf.generic._data_structures.ArrayObject) -> None
|
| Direct reference link being preserved until we can resolve it correctly.
|
| Methods defined here:
|
| __init__(self, reference: pypdf.generic._data_structures.ArrayObject) -> None
| reference: an ArrayObject whose first element is the Page indirect object
|
| find_referenced_page(self) -> pypdf.generic._base.IndirectObject
|
| patch_reference(self, target_pdf: 'PdfWriter', new_page: pypdf.generic._base.IndirectObject) -> None
| target_pdf: PdfWriter which the new link went into
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class EmbeddedFile(builtins.object)
| EmbeddedFile(name: 'str', pdf_object: 'DictionaryObject', parent: 'ArrayObject | None' = None) -> 'None'
|
| Container holding the information on an embedded file.
|
| Attributes are evaluated lazily if possible.
|
| Further information on embedded files can be found in section 7.11 of the PDF 2.0 specification.
|
| Methods defined here:
|
| __init__(self, name: 'str', pdf_object: 'DictionaryObject', parent: 'ArrayObject | None' = None) -> 'None'
| Args:
| name: The (primary) name as provided in the name tree.
| pdf_object: The corresponding PDF object to allow retrieving further data.
| parent: The parent list.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| delete(self) -> 'None'
| Delete the file from the document.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
| The (primary) name of the embedded file as provided in the name tree.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| alternative_name
| Retrieve the alternative name (file specification).
|
| associated_file_relationship
| Retrieve the relationship of the referring document to this embedded file.
|
| checksum
| Retrieve the MD5 checksum of the (uncompressed) file.
|
| content
| Retrieve the actual file content.
|
| creation_date
| Retrieve the file creation datetime.
|
| description
| Retrieve the description.
|
| modification_date
| Retrieve the datetime of the last file modification.
|
| size
| Retrieve the size of the uncompressed file in bytes.
|
| subtype
| Retrieve the subtype. This is a MIME media type, prefixed by a slash.
class EncodedStreamObject(StreamObject)
| EncodedStreamObject() -> None
|
| Method resolution order:
| EncodedStreamObject
| StreamObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| get_data(self) -> bytes
| # This overrides the parent method
|
| set_data(self, data: bytes) -> None
| # This overrides the parent method:
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from StreamObject:
|
| decode_as_image(self, pillow_parameters: Optional[dict[str, Any]] = None) -> Any
| Try to decode the stream object as an image
|
| Args:
| pillow_parameters: parameters provided to Pillow Image.save() method,
| cf. <https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save>
|
| Returns:
| a PIL image if proper decoding has been found
| Raises:
| Exception: Errors during decoding will be reported.
| It is recommended to catch exceptions to prevent
| stops in your program.
|
| flate_encode(self, level: int = -1) -> 'EncodedStreamObject'
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'StreamObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from StreamObject:
|
| initialize_from_dictionary(data: dict[str, typing.Any]) -> Union[ForwardRef('EncodedStreamObject'), ForwardRef('DecodedStreamObject')]
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| raw_get(self, key: Any) -> Any
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class Field(TreeObject)
| Field(data: pypdf.generic._data_structures.DictionaryObject) -> None
|
| A class representing a field dictionary.
|
| This class is accessed through
| :meth:`get_fields()<pypdf.PdfReader.get_fields>`
|
| Method resolution order:
| Field
| TreeObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, data: pypdf.generic._data_structures.DictionaryObject) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| additional_actions
| Read-only property accessing the additional actions dictionary.
|
| This dictionary defines the field's behavior in response to trigger
| events. See Section 8.5.2 of the PDF 1.7 reference.
|
| alternate_name
| Read-only property accessing the alternate name of this field.
|
| default_value
| Read-only property accessing the default value of this field.
|
| field_type
| Read-only property accessing the type of this field.
|
| flags
| Read-only property accessing the field flags, specifying various
| characteristics of the field (see Table 8.70 of the PDF 1.7 reference).
|
| kids
| Read-only property accessing the kids of this field.
|
| mapping_name
| Read-only property accessing the mapping name of this field.
|
| This name is used by pypdf as a key in the dictionary returned by
| :meth:`get_fields()<pypdf.PdfReader.get_fields>`
|
| name
| Read-only property accessing the name of this field.
|
| parent
| Read-only property accessing the parent of this field.
|
| value
| Read-only property accessing the value of this field.
|
| Format varies based on field type.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from TreeObject:
|
| __iter__(self) -> Any
| Implement iter(self).
|
| add_child(self, child: Any, pdf: pypdf._protocols.PdfWriterProtocol) -> None
|
| children(self) -> collections.abc.Iterable[typing.Any]
|
| empty_tree(self) -> None
|
| has_children(self) -> bool
|
| inc_parent_counter_default(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| inc_parent_counter_outline(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| insert_child(self, child: Any, before: Any, pdf: pypdf._protocols.PdfWriterProtocol, inc_parent_counter: Optional[Callable[..., Any]] = None) -> pypdf.generic._base.IndirectObject
|
| remove_child(self, child: Any) -> None
|
| remove_from_tree(self) -> None
| Remove the object from the tree it is in.
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class Fit(builtins.object)
| Fit(fit_type: str, fit_args: tuple[typing.Union[NoneType, float, typing.Any], ...] = ()) -> None
|
| Methods defined here:
|
| __init__(self, fit_type: str, fit_args: tuple[typing.Union[NoneType, float, typing.Any], ...] = ()) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self) -> str
| Return str(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fit() -> 'Fit'
| Display the page designated by page, with its contents magnified just
| enough to fit the entire page within the window both horizontally and
| vertically.
|
| If the required horizontal and vertical magnification factors are
| different, use the smaller of the two, centering the page within the
| window in the other dimension.
|
| fit_box() -> 'Fit'
| Display the page designated by page, with its contents magnified just
| enough to fit its bounding box entirely within the window both
| horizontally and vertically.
|
| If the required horizontal and vertical magnification factors are
| different, use the smaller of the two, centering the bounding box
| within the window in the other dimension.
|
| fit_box_horizontally(top: Optional[float] = None) -> 'Fit'
| Display the page designated by page, with the vertical coordinate top
| positioned at the top edge of the window and the contents of the page
| magnified just enough to fit the entire width of its bounding box
| within the window.
|
| A null value for top specifies that the current value of that parameter
| is to be retained unchanged.
|
| Args:
| top:
|
| Returns:
| The created fit object.
|
| fit_box_vertically(left: Optional[float] = None) -> 'Fit'
| Display the page designated by page, with the horizontal coordinate
| left positioned at the left edge of the window and the contents of the
| page magnified just enough to fit the entire height of its bounding box
| within the window.
|
| A null value for left specifies that the current value of that
| parameter is to be retained unchanged.
|
| Args:
| left:
|
| Returns:
| The created fit object.
|
| fit_horizontally(top: Optional[float] = None) -> 'Fit'
| Display the page designated by page, with the vertical coordinate top
| positioned at the top edge of the window and the contents of the page
| magnified just enough to fit the entire width of the page within the
| window.
|
| A null value for ``top`` specifies that the current value of that
| parameter is to be retained unchanged.
|
| Args:
| top:
|
| Returns:
| The created fit object.
|
| fit_rectangle(left: Optional[float] = None, bottom: Optional[float] = None, right: Optional[float] = None, top: Optional[float] = None) -> 'Fit'
| Display the page designated by page, with its contents magnified
| just enough to fit the rectangle specified by the coordinates
| left, bottom, right, and top entirely within the window
| both horizontally and vertically.
|
| If the required horizontal and vertical magnification factors are
| different, use the smaller of the two, centering the rectangle within
| the window in the other dimension.
|
| A null value for any of the parameters may result in unpredictable
| behavior.
|
| Args:
| left:
| bottom:
| right:
| top:
|
| Returns:
| The created fit object.
|
| fit_vertically(left: Optional[float] = None) -> 'Fit'
|
| xyz(left: Optional[float] = None, top: Optional[float] = None, zoom: Optional[float] = None) -> 'Fit'
| Display the page designated by page, with the coordinates (left, top)
| positioned at the upper-left corner of the window and the contents
| of the page magnified by the factor zoom.
|
| A null value for any of the parameters left, top, or zoom specifies
| that the current value of that parameter is to be retained unchanged.
|
| A zoom value of 0 has the same meaning as a null value.
|
| Args:
| left:
| top:
| zoom:
|
| Returns:
| The created fit object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class FloatObject(builtins.float, PdfObject)
| FloatObject(value: Any = '0.0', context: Optional[Any] = None) -> Self
|
| Method resolution order:
| FloatObject
| builtins.float
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __repr__(self) -> str
| Return repr(self).
|
| as_numeric(self) -> float
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'FloatObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| myrepr(self) -> str
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, value: Any = '0.0', context: Optional[Any] = None) -> Self
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.float:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(self, /)
| Return the ceiling as an Integral.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(self, /)
| Return the floor as an Integral.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Formats the float according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(self, ndigits=None, /)
| Return the Integral closest to x, rounding half toward even.
|
| When an argument is passed, work like built-in round(x, ndigits).
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(self, /)
| Return the Integral closest to x between 0 and x.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is exactly equal to the original float.
|
| The ratio is in lowest terms and has a positive denominator. Raise
| OverflowError on infinities and a ValueError on NaNs.
|
| >>> (10.0).as_integer_ratio()
| (10, 1)
| >>> (0.0).as_integer_ratio()
| (0, 1)
| >>> (-.25).as_integer_ratio()
| (-1, 4)
|
| conjugate(self, /)
| Return self, the complex conjugate of any float.
|
| hex(self, /)
| Return a hexadecimal representation of a floating-point number.
|
| >>> (-0.1).hex()
| '-0x1.999999999999ap-4'
| >>> 3.14159.hex()
| '0x1.921f9f01b866ep+1'
|
| is_integer(self, /)
| Return True if the float is an integer.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.float:
|
| __getformat__(typestr, /)
| You probably don't want to use this function.
|
| typestr
| Must be 'double' or 'float'.
|
| It exists mainly to be used in Python's test suite.
|
| This function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE,
| little-endian' best describes the format of floating-point numbers used by the
| C type named by typestr.
|
| fromhex(string, /)
| Create a floating-point number from a hexadecimal string.
|
| >>> float.fromhex('0x1.ffffp10')
| 2047.984375
| >>> float.fromhex('-0x1p-1074')
| -5e-324
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.float:
|
| imag
| the imaginary part of a complex number
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class IndirectObject(PdfObject)
| IndirectObject(idnum: int, generation: int, pdf: Any) -> None
|
| Method resolution order:
| IndirectObject
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __contains__(self, key: Any) -> bool
|
| __deepcopy__(self, memo: Any) -> 'IndirectObject'
|
| __eq__(self, other: object) -> bool
| Return self==value.
|
| __float__(self) -> str
|
| __getattr__(self, name: str) -> Any
|
| __getitem__(self, key: Any) -> Any
|
| __hash__(self) -> int
| Return hash(self).
|
| __init__(self, idnum: int, generation: int, pdf: Any) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self) -> int
|
| __iter__(self) -> Any
|
| __ne__(self, other: object) -> bool
| Return self!=value.
|
| __repr__(self) -> str
| Return repr(self).
|
| __str__(self) -> str
| Return str(self).
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'IndirectObject'
| Clone object into pdf_dest.
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any], pdf: Any) -> 'IndirectObject'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| indirect_reference
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| Function to initialize subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class NameObject(builtins.str, PdfObject)
| Method resolution order:
| NameObject
| builtins.str
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs) from builtins.object
| Initialize self. See help(type(self)) for accurate signature.
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'NameObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| renumber(self) -> bytes
|
| surfix
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any], pdf: Any) -> 'NameObject'
|
| unnumber(sin: bytes) -> bytes
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CHARSETS = ('utf-8', 'gbk', 'latin1')
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'renumber_table': typing.ClassVar[dict[str, bytes]]...
|
| __parameters__ = ()
|
| delimiter_pattern = re.compile(b'\\s+|[\\(\\)<>\\[\\]{}/%]')
|
| prefix = b'/'
|
| renumber_table = {'\x00': b'#00', '\x01': b'#01', '\x02': b'#02', '\x0...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.str:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __format__(self, format_spec, /)
| Return a formatted version of the string as described by format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __sizeof__(self, /)
| Return the size of the string in memory, in bytes.
|
| __str__(self, /)
| Return str(self).
|
| capitalize(self, /)
| Return a capitalized version of the string.
|
| More specifically, make the first character have upper case and the rest lower
| case.
|
| casefold(self, /)
| Return a version of the string suitable for caseless comparisons.
|
| center(self, width, fillchar=' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| count(...)
| S.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are
| interpreted as in slice notation.
|
| encode(self, /, encoding='utf-8', errors='strict')
| Encode the string using the codec registered for encoding.
|
| encoding
| The encoding in which to encode the string.
| errors
| The error handling scheme to use for encoding errors.
| The default is 'strict' meaning that encoding errors raise a
| UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
| 'xmlcharrefreplace' as well as any other name registered with
| codecs.register_error that can handle UnicodeEncodeErrors.
|
| endswith(...)
| S.endswith(suffix[, start[, end]]) -> bool
|
| Return True if S ends with the specified suffix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| suffix can also be a tuple of strings to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| S.find(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| format(...)
| S.format(*args, **kwargs) -> str
|
| Return a formatted version of S, using substitutions from args and kwargs.
| The substitutions are identified by braces ('{' and '}').
|
| format_map(...)
| S.format_map(mapping) -> str
|
| Return a formatted version of S, using substitutions from mapping.
| The substitutions are identified by braces ('{' and '}').
|
| index(...)
| S.index(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| isalnum(self, /)
| Return True if the string is an alpha-numeric string, False otherwise.
|
| A string is alpha-numeric if all characters in the string are alpha-numeric and
| there is at least one character in the string.
|
| isalpha(self, /)
| Return True if the string is an alphabetic string, False otherwise.
|
| A string is alphabetic if all characters in the string are alphabetic and there
| is at least one character in the string.
|
| isascii(self, /)
| Return True if all characters in the string are ASCII, False otherwise.
|
| ASCII characters have code points in the range U+0000-U+007F.
| Empty string is ASCII too.
|
| isdecimal(self, /)
| Return True if the string is a decimal string, False otherwise.
|
| A string is a decimal string if all characters in the string are decimal and
| there is at least one character in the string.
|
| isdigit(self, /)
| Return True if the string is a digit string, False otherwise.
|
| A string is a digit string if all characters in the string are digits and there
| is at least one character in the string.
|
| isidentifier(self, /)
| Return True if the string is a valid Python identifier, False otherwise.
|
| Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
| such as "def" or "class".
|
| islower(self, /)
| Return True if the string is a lowercase string, False otherwise.
|
| A string is lowercase if all cased characters in the string are lowercase and
| there is at least one cased character in the string.
|
| isnumeric(self, /)
| Return True if the string is a numeric string, False otherwise.
|
| A string is numeric if all characters in the string are numeric and there is at
| least one character in the string.
|
| isprintable(self, /)
| Return True if the string is printable, False otherwise.
|
| A string is printable if all of its characters are considered printable in
| repr() or if it is empty.
|
| isspace(self, /)
| Return True if the string is a whitespace string, False otherwise.
|
| A string is whitespace if all characters in the string are whitespace and there
| is at least one character in the string.
|
| istitle(self, /)
| Return True if the string is a title-cased string, False otherwise.
|
| In a title-cased string, upper- and title-case characters may only
| follow uncased characters and lowercase characters only cased ones.
|
| isupper(self, /)
| Return True if the string is an uppercase string, False otherwise.
|
| A string is uppercase if all cased characters in the string are uppercase and
| there is at least one cased character in the string.
|
| join(self, iterable, /)
| Concatenate any number of strings.
|
| The string whose method is called is inserted in between each given string.
| The result is returned as a new string.
|
| Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
| ljust(self, width, fillchar=' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| lower(self, /)
| Return a copy of the string converted to lowercase.
|
| lstrip(self, chars=None, /)
| Return a copy of the string with leading whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| partition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original string
| and two empty strings.
|
| removeprefix(self, prefix, /)
| Return a str with the given prefix string removed if present.
|
| If the string starts with the prefix string, return string[len(prefix):].
| Otherwise, return a copy of the original string.
|
| removesuffix(self, suffix, /)
| Return a str with the given suffix string removed if present.
|
| If the string ends with the suffix string and that suffix is not empty,
| return string[:-len(suffix)]. Otherwise, return a copy of the original
| string.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| S.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| S.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| rjust(self, width, fillchar=' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| rpartition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty strings
| and the original string.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the end of the string and works to the front.
|
| rstrip(self, chars=None, /)
| Return a copy of the string with trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the front of the string and works to the end.
|
| Note, str.split() is mainly useful for data that has been intentionally
| delimited. With natural text that includes punctuation, consider using
| the regular expression module.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the string, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.
|
| strip(self, chars=None, /)
| Return a copy of the string with leading and trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| swapcase(self, /)
| Convert uppercase characters to lowercase and lowercase characters to uppercase.
|
| title(self, /)
| Return a version of the string where each word is titlecased.
|
| More specifically, words start with uppercased characters and all remaining
| cased characters have lower case.
|
| translate(self, table, /)
| Replace each character in the string using the given translation table.
|
| table
| Translation table, which must be a mapping of Unicode ordinals to
| Unicode ordinals, strings, or None.
|
| The table must implement lookup/indexing via __getitem__, for instance a
| dictionary or list. If this operation raises LookupError, the character is
| left untouched. Characters mapped to None are deleted.
|
| upper(self, /)
| Return a copy of the string converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The string is never truncated.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.str:
|
| __new__(*args, **kwargs) class method of builtins.str
| Create and return a new object. See help(type) for accurate signature.
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class NamedReferenceLink(builtins.object)
| NamedReferenceLink(reference: pypdf.generic._base.TextStringObject, source_pdf: 'PdfReader') -> None
|
| Named reference link being preserved until we can resolve it correctly.
|
| Methods defined here:
|
| __init__(self, reference: pypdf.generic._base.TextStringObject, source_pdf: 'PdfReader') -> None
| reference: TextStringObject with named reference
|
| find_referenced_page(self) -> Optional[pypdf.generic._base.IndirectObject]
|
| patch_reference(self, target_pdf: 'PdfWriter', new_page: pypdf.generic._base.IndirectObject) -> None
| target_pdf: PdfWriter which the new link went into
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class NullObject(PdfObject)
| NullObject(*args, **kwargs)
|
| Method resolution order:
| NullObject
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __eq__(self, other: object) -> bool
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __repr__(self) -> str
| Return repr(self).
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'NullObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| read_from_stream(stream: IO[Any]) -> 'NullObject'
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| Function to initialize subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class NumberObject(builtins.int, PdfObject)
| NumberObject(value: Any) -> Self
|
| Method resolution order:
| NumberObject
| builtins.int
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| as_numeric(self) -> int
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'NumberObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, value: Any) -> Self
| Create and return a new object. See help(type) for accurate signature.
|
| read_from_stream(stream: IO[Any]) -> Union[ForwardRef('NumberObject'), ForwardRef('FloatObject')]
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| NumberPattern = re.compile(b'[^+-.0-9]')
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class OutlineFontFlag(enum.IntFlag)
| OutlineFontFlag(*values)
|
| A class used as an enumerable flag for formatting an outline font.
|
| Method resolution order:
| OutlineFontFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| bold = <OutlineFontFlag.bold: 2>
|
| italic = <OutlineFontFlag.italic: 1>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class OutlineItem(pypdf.generic._data_structures.Destination)
| OutlineItem(title: Union[str, bytes], page: Union[pypdf.generic._base.NumberObject, pypdf.generic._base.IndirectObject, pypdf.generic._base.NullObject, pypdf.generic._data_structures.DictionaryObject], fit: pypdf.generic._fit.Fit) -> None
|
| Method resolution order:
| OutlineItem
| pypdf.generic._data_structures.Destination
| pypdf.generic._data_structures.TreeObject
| pypdf.generic._data_structures.DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.Destination:
|
| __init__(self, title: Union[str, bytes], page: Union[pypdf.generic._base.NumberObject, pypdf.generic._base.IndirectObject, pypdf.generic._base.NullObject, pypdf.generic._data_structures.DictionaryObject], fit: pypdf.generic._fit.Fit) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf.generic._data_structures.Destination:
|
| bottom
| Read-only property accessing the bottom vertical coordinate.
|
| color
| Read-only property accessing the color in (R, G, B) with values 0.0-1.0.
|
| dest_array
|
| font_format
| Read-only property accessing the font type.
|
| 1=italic, 2=bold, 3=both
|
| left
| Read-only property accessing the left horizontal coordinate.
|
| outline_count
| Read-only property accessing the outline count.
|
| positive = expanded
| negative = collapsed
| absolute value = number of visible descendants at all levels
|
| page
| Read-only property accessing the IndirectObject of the destination page.
|
| right
| Read-only property accessing the right horizontal coordinate.
|
| title
| Read-only property accessing the destination title.
|
| top
| Read-only property accessing the top vertical coordinate.
|
| typ
| Read-only property accessing the destination type.
|
| zoom
| Read-only property accessing the zoom factor.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.Destination:
|
| node = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.TreeObject:
|
| __iter__(self) -> Any
| Implement iter(self).
|
| add_child(self, child: Any, pdf: pypdf._protocols.PdfWriterProtocol) -> None
|
| children(self) -> collections.abc.Iterable[typing.Any]
|
| empty_tree(self) -> None
|
| has_children(self) -> bool
|
| inc_parent_counter_default(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| inc_parent_counter_outline(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| insert_child(self, child: Any, before: Any, pdf: pypdf._protocols.PdfWriterProtocol, inc_parent_counter: Optional[Callable[..., Any]] = None) -> pypdf.generic._base.IndirectObject
|
| remove_child(self, child: Any) -> None
|
| remove_from_tree(self) -> None
| Remove the object from the tree it is in.
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf.generic._data_structures.DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class PdfObject(pypdf._protocols.PdfObjectProtocol)
| PdfObject(*args, **kwargs)
|
| Method resolution order:
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter).
|
| By default, this method will call ``_reference_clone`` (see ``_reference``).
|
|
| Args:
| pdf_dest: Target to clone to.
| force_duplicate: By default, if the object has already been cloned and referenced,
| the copy will be returned; when ``True``, a new copy will be created.
| (Default value = ``False``)
| ignore_fields: List/tuple of field names (for dictionaries) that will be ignored
| during cloning (applies to children duplication as well). If fields are to be
| considered for a limited number of levels, you have to add it as integer, for
| example ``[1,"/B","/TOTO"]`` means that ``"/B"`` will be ignored at the first
| level only but ``"/TOTO"`` on all levels.
|
| Returns:
| The cloned PdfObject
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'hash_func': typing.Callable[..., ForwardRef('hashl...
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| Function to initialize subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class RectangleObject(pypdf.generic._data_structures.ArrayObject)
| RectangleObject(arr: Union[ForwardRef('RectangleObject'), tuple[float, float, float, float]]) -> None
|
| This class is used to represent *page boxes* in pypdf.
|
| These boxes include:
|
| * :attr:`artbox <pypdf._page.PageObject.artbox>`
| * :attr:`bleedbox <pypdf._page.PageObject.bleedbox>`
| * :attr:`cropbox <pypdf._page.PageObject.cropbox>`
| * :attr:`mediabox <pypdf._page.PageObject.mediabox>`
| * :attr:`trimbox <pypdf._page.PageObject.trimbox>`
|
| Method resolution order:
| RectangleObject
| pypdf.generic._data_structures.ArrayObject
| builtins.list
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, arr: Union[ForwardRef('RectangleObject'), tuple[float, float, float, float]]) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> str
| Return repr(self).
|
| scale(self, sx: float, sy: float) -> 'RectangleObject'
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| height
|
| width
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| bottom
|
| left
|
| lower_left
| Property to read and modify the lower left coordinate of this box
| in (x,y) form.
|
| lower_right
| Property to read and modify the lower right coordinate of this box
| in (x,y) form.
|
| right
|
| top
|
| upper_left
| Property to read and modify the upper left coordinate of this box
| in (x,y) form.
|
| upper_right
| Property to read and modify the upper right coordinate of this box
| in (x,y) form.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.ArrayObject:
|
| __add__(self, lst: Any) -> 'ArrayObject'
| Allow extension by adding list or add one element only
|
| Args:
| lst: any list, tuples are extended the list.
| other types(numbers,...) will be appended.
| if str is passed it will be converted into TextStringObject
| or NameObject (if starting with "/")
| if bytes is passed it will be converted into ByteStringObject
|
| Returns:
| ArrayObject with all elements
|
| __iadd__(self, lst: Any) -> Self
| Allow extension by adding list or add one element only
|
| Args:
| lst: any list, tuples are extended the list.
| other types(numbers,...) will be appended.
| if str is passed it will be converted into TextStringObject
| or NameObject (if starting with "/")
| if bytes is passed it will be converted into ByteStringObject
|
| __isub__(self, lst: Any) -> Self
| Allow to remove items
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'ArrayObject'
| Clone object into pdf_dest.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| items(self) -> collections.abc.Iterable[typing.Any]
| Emulate DictionaryObject.items for a list (index, object).
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'ArrayObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._data_structures.ArrayObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'ArrayObject'
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf.generic._data_structures.ArrayObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.ArrayObject:
|
| __orig_bases__ = (list[typing.Any], <class 'pypdf.generic._base.PdfObj...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.list:
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, index, /)
| Return self[index].
|
| __gt__(self, value, /)
| Return self>value.
|
| __imul__(self, value, /)
| Implement self*=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the list.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(self, /)
| Return the size of the list in memory, in bytes.
|
| append(self, object, /)
| Append object to the end of the list.
|
| clear(self, /)
| Remove all items from list.
|
| copy(self, /)
| Return a shallow copy of the list.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| extend(self, iterable, /)
| Extend list by appending elements from the iterable.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| insert(self, index, object, /)
| Insert object before index.
|
| pop(self, index=-1, /)
| Remove and return item at index (default last).
|
| Raises IndexError if list is empty or index is out of range.
|
| remove(self, value, /)
| Remove first occurrence of value.
|
| Raises ValueError if the value is not present.
|
| reverse(self, /)
| Reverse *IN PLACE*.
|
| sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
| order of two equal elements is maintained).
|
| If a key function is given, apply it once to each list item and sort them,
| ascending or descending, according to their function values.
|
| The reverse flag can be set to sort in descending order.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.list:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.list:
|
| __new__(*args, **kwargs) class method of builtins.list
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.list:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class StreamObject(DictionaryObject)
| StreamObject() -> None
|
| Method resolution order:
| StreamObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| decode_as_image(self, pillow_parameters: Optional[dict[str, Any]] = None) -> Any
| Try to decode the stream object as an image
|
| Args:
| pillow_parameters: parameters provided to Pillow Image.save() method,
| cf. <https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save>
|
| Returns:
| a PIL image if proper decoding has been found
| Raises:
| Exception: Errors during decoding will be reported.
| It is recommended to catch exceptions to prevent
| stops in your program.
|
| flate_encode(self, level: int = -1) -> 'EncodedStreamObject'
|
| get_data(self) -> bytes
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'StreamObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| set_data(self, data: bytes) -> None
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| initialize_from_dictionary(data: dict[str, typing.Any]) -> Union[ForwardRef('EncodedStreamObject'), ForwardRef('DecodedStreamObject')]
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| raw_get(self, key: Any) -> Any
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class TextStringObject(builtins.str, PdfObject)
| TextStringObject(value: Any) -> Self
|
| A string object that has been decoded into a real unicode string.
|
| If read from a PDF document, this string appeared to match the
| PDFDocEncoding, or contained a UTF-16BE BOM mark to cause UTF-16 decoding
| to occur.
|
| Method resolution order:
| TextStringObject
| builtins.str
| PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| clone(self, pdf_dest: Any, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'TextStringObject'
| Clone object into pdf_dest.
|
| get_encoded_bytes(self) -> bytes
|
| get_original_bytes(self) -> bytes
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, value: Any) -> Self
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| original_bytes
| It is occasionally possible that a text string object gets created where
| a byte string object was expected due to the autodetection mechanism --
| if that occurs, this "original_bytes" property can be used to
| back-calculate what the original encoded bytes were.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'_original_bytes': typing.Optional[bytes], 'autodet...
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.str:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __format__(self, format_spec, /)
| Return a formatted version of the string as described by format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __sizeof__(self, /)
| Return the size of the string in memory, in bytes.
|
| __str__(self, /)
| Return str(self).
|
| capitalize(self, /)
| Return a capitalized version of the string.
|
| More specifically, make the first character have upper case and the rest lower
| case.
|
| casefold(self, /)
| Return a version of the string suitable for caseless comparisons.
|
| center(self, width, fillchar=' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| count(...)
| S.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are
| interpreted as in slice notation.
|
| encode(self, /, encoding='utf-8', errors='strict')
| Encode the string using the codec registered for encoding.
|
| encoding
| The encoding in which to encode the string.
| errors
| The error handling scheme to use for encoding errors.
| The default is 'strict' meaning that encoding errors raise a
| UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
| 'xmlcharrefreplace' as well as any other name registered with
| codecs.register_error that can handle UnicodeEncodeErrors.
|
| endswith(...)
| S.endswith(suffix[, start[, end]]) -> bool
|
| Return True if S ends with the specified suffix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| suffix can also be a tuple of strings to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| S.find(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| format(...)
| S.format(*args, **kwargs) -> str
|
| Return a formatted version of S, using substitutions from args and kwargs.
| The substitutions are identified by braces ('{' and '}').
|
| format_map(...)
| S.format_map(mapping) -> str
|
| Return a formatted version of S, using substitutions from mapping.
| The substitutions are identified by braces ('{' and '}').
|
| index(...)
| S.index(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| isalnum(self, /)
| Return True if the string is an alpha-numeric string, False otherwise.
|
| A string is alpha-numeric if all characters in the string are alpha-numeric and
| there is at least one character in the string.
|
| isalpha(self, /)
| Return True if the string is an alphabetic string, False otherwise.
|
| A string is alphabetic if all characters in the string are alphabetic and there
| is at least one character in the string.
|
| isascii(self, /)
| Return True if all characters in the string are ASCII, False otherwise.
|
| ASCII characters have code points in the range U+0000-U+007F.
| Empty string is ASCII too.
|
| isdecimal(self, /)
| Return True if the string is a decimal string, False otherwise.
|
| A string is a decimal string if all characters in the string are decimal and
| there is at least one character in the string.
|
| isdigit(self, /)
| Return True if the string is a digit string, False otherwise.
|
| A string is a digit string if all characters in the string are digits and there
| is at least one character in the string.
|
| isidentifier(self, /)
| Return True if the string is a valid Python identifier, False otherwise.
|
| Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
| such as "def" or "class".
|
| islower(self, /)
| Return True if the string is a lowercase string, False otherwise.
|
| A string is lowercase if all cased characters in the string are lowercase and
| there is at least one cased character in the string.
|
| isnumeric(self, /)
| Return True if the string is a numeric string, False otherwise.
|
| A string is numeric if all characters in the string are numeric and there is at
| least one character in the string.
|
| isprintable(self, /)
| Return True if the string is printable, False otherwise.
|
| A string is printable if all of its characters are considered printable in
| repr() or if it is empty.
|
| isspace(self, /)
| Return True if the string is a whitespace string, False otherwise.
|
| A string is whitespace if all characters in the string are whitespace and there
| is at least one character in the string.
|
| istitle(self, /)
| Return True if the string is a title-cased string, False otherwise.
|
| In a title-cased string, upper- and title-case characters may only
| follow uncased characters and lowercase characters only cased ones.
|
| isupper(self, /)
| Return True if the string is an uppercase string, False otherwise.
|
| A string is uppercase if all cased characters in the string are uppercase and
| there is at least one cased character in the string.
|
| join(self, iterable, /)
| Concatenate any number of strings.
|
| The string whose method is called is inserted in between each given string.
| The result is returned as a new string.
|
| Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
| ljust(self, width, fillchar=' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| lower(self, /)
| Return a copy of the string converted to lowercase.
|
| lstrip(self, chars=None, /)
| Return a copy of the string with leading whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| partition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original string
| and two empty strings.
|
| removeprefix(self, prefix, /)
| Return a str with the given prefix string removed if present.
|
| If the string starts with the prefix string, return string[len(prefix):].
| Otherwise, return a copy of the original string.
|
| removesuffix(self, suffix, /)
| Return a str with the given suffix string removed if present.
|
| If the string ends with the suffix string and that suffix is not empty,
| return string[:-len(suffix)]. Otherwise, return a copy of the original
| string.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| S.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| S.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| rjust(self, width, fillchar=' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| rpartition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty strings
| and the original string.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the end of the string and works to the front.
|
| rstrip(self, chars=None, /)
| Return a copy of the string with trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the front of the string and works to the end.
|
| Note, str.split() is mainly useful for data that has been intentionally
| delimited. With natural text that includes punctuation, consider using
| the regular expression module.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the string, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.
|
| strip(self, chars=None, /)
| Return a copy of the string with leading and trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| swapcase(self, /)
| Convert uppercase characters to lowercase and lowercase characters to uppercase.
|
| title(self, /)
| Return a version of the string where each word is titlecased.
|
| More specifically, words start with uppercased characters and all remaining
| cased characters have lower case.
|
| translate(self, table, /)
| Replace each character in the string using the given translation table.
|
| table
| Translation table, which must be a mapping of Unicode ordinals to
| Unicode ordinals, strings, or None.
|
| The table must implement lookup/indexing via __getitem__, for instance a
| dictionary or list. If this operation raises LookupError, the character is
| left untouched. Characters mapped to None are deleted.
|
| upper(self, /)
| Return a copy of the string converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The string is never truncated.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.str:
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| Methods inherited from PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf._protocols.PdfObjectProtocol:
|
| __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
class TreeObject(DictionaryObject)
| TreeObject(dct: Optional[pypdf.generic._data_structures.DictionaryObject] = None) -> None
|
| Method resolution order:
| TreeObject
| DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, dct: Optional[pypdf.generic._data_structures.DictionaryObject] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> Any
| Implement iter(self).
|
| add_child(self, child: Any, pdf: pypdf._protocols.PdfWriterProtocol) -> None
|
| children(self) -> collections.abc.Iterable[typing.Any]
|
| empty_tree(self) -> None
|
| has_children(self) -> bool
|
| inc_parent_counter_default(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| inc_parent_counter_outline(self, parent: Union[NoneType, pypdf.generic._base.IndirectObject, ForwardRef('TreeObject')], n: int) -> None
|
| insert_child(self, child: Any, before: Any, pdf: pypdf._protocols.PdfWriterProtocol, inc_parent_counter: Optional[Callable[..., Any]] = None) -> pypdf.generic._base.IndirectObject
|
| remove_child(self, child: Any) -> None
|
| remove_from_tree(self) -> None
| Remove the object from the tree it is in.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
class ViewerPreferences(pypdf.generic._data_structures.DictionaryObject)
| ViewerPreferences(value: Any = None) -> 'ViewerPreferences'
|
| Method resolution order:
| ViewerPreferences
| pypdf.generic._data_structures.DictionaryObject
| builtins.dict
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, obj: Optional[pypdf.generic._data_structures.DictionaryObject] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls: Any, value: Any = None) -> 'ViewerPreferences'
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| PRINT_SCALING
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __getitem__(self, key: Any) -> pypdf.generic._base.PdfObject
| Return self[key].
|
| __setitem__(self, key: Any, value: Any) -> Any
| Set self[key] to value.
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'DictionaryObject'
| Clone object into pdf_dest.
|
| get_inherited(self, key: str, default: Any = None) -> Any
| Returns the value of a key or from the parent if not found.
| If not found returns default.
|
| Args:
| key: string identifying the field to return
|
| default: default value to return
|
| Returns:
| Current key or inherited one, otherwise default value.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| raw_get(self, key: Any) -> Any
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'DictionaryObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| setdefault(self, key: Any, value: Optional[Any] = None) -> Any
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._data_structures.DictionaryObject:
|
| read_from_stream(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> 'DictionaryObject'
|
| ----------------------------------------------------------------------
| Readonly properties inherited from pypdf.generic._data_structures.DictionaryObject:
|
| xmp_metadata
| Retrieve XMP (Extensible Metadata Platform) data relevant to this
| object, if available.
|
| See Table 347 — Additional entries in a metadata stream dictionary.
|
| Returns:
| Returns a :class:`~pypdf.xmp.XmpInformation` instance
| that can be used to access XMP metadata from the document. Can also
| return None if no metadata was found on the document root.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf.generic._data_structures.DictionaryObject:
|
| __orig_bases__ = (dict[typing.Any, typing.Any], <class 'pypdf.generic....
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
FUNCTIONS
create_string_object(string: Union[str, bytes], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> Union[pypdf.generic._base.TextStringObject, pypdf.generic._base.ByteStringObject]
Create a ByteStringObject or a TextStringObject from a string to represent the string.
Args:
string: The data being used
forced_encoding: Typically None, or an encoding string
Returns:
A ByteStringObject
Raises:
TypeError: If string is not of type str or bytes.
decode_pdfdocencoding(byte_array: bytes) -> str
encode_pdfdocencoding(unicode_string: str) -> bytes
extract_links(new_page: 'PageObject', old_page: 'PageObject') -> list[tuple[typing.Union[pypdf.generic._link.NamedReferenceLink, pypdf.generic._link.DirectReferenceLink], typing.Union[pypdf.generic._link.NamedReferenceLink, pypdf.generic._link.DirectReferenceLink]]]
Extracts links from two pages on the assumption that the two pages are
the same. Produces one list of (new link, old link) tuples.
Non-link annotations are ignored before pairing to avoid dropping valid
links when one page includes additional non-link annotation entries.
hex_to_rgb(value: str) -> tuple[float, float, float]
is_null_or_none(x: Any) -> TypeGuard[Union[NoneType, pypdf.generic._base.NullObject, pypdf.generic._base.IndirectObject]]
Returns:
True if x is None or NullObject.
read_hex_string_from_stream(stream: IO[Any], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> Union[ForwardRef('TextStringObject'), ForwardRef('ByteStringObject')]
read_object(stream: IO[Any], pdf: Optional[pypdf._protocols.PdfReaderProtocol], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> Union[pypdf.generic._base.PdfObject, int, str, pypdf.generic._data_structures.ContentStream]
read_string_from_stream(stream: IO[Any], forced_encoding: Union[NoneType, str, list[str], dict[int, str]] = None) -> Union[ForwardRef('TextStringObject'), ForwardRef('ByteStringObject')]
DATA
PAGE_FIT = <pypdf.generic._fit.Fit object>
ReferenceLink = typing.Union[pypdf.generic._link.NamedReferenceLink, p...
__all__ = ['PAGE_FIT', 'ArrayObject', 'BooleanObject', 'ByteStringObje...
__author_email__ = 'biziqe@mathieu.fenniak.net'
AUTHOR
Mathieu Fenniak
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\generic\__init__.py
pypdf.mult
Python Library Documentation: function mult in module pypdf._text_extraction mult(m: list[float], n: list[float]) -> list[float]
pypdf.pagerange
Python Library Documentation: module pypdf.pagerange in pypdf
NAME
pypdf.pagerange - Representation and utils for ranges of PDF file pages.
DESCRIPTION
Copyright (c) 2014, Steve Witham <switham_github@mac-guyver.com>.
All rights reserved. This software is available under a BSD license;
see https://github.com/py-pdf/pypdf/blob/main/LICENSE
CLASSES
builtins.object
PageRange
class PageRange(builtins.object)
| PageRange(arg: Union[slice, ForwardRef('PageRange'), str]) -> None
|
| A slice-like representation of a range of page indices.
|
| For example, page numbers, only starting at zero.
|
| The syntax is like what you would put between brackets [ ].
| The slice is one of the few Python types that can't be subclassed,
| but this class converts to and from slices, and allows similar use.
|
| - PageRange(str) parses a string representing a page range.
| - PageRange(slice) directly "imports" a slice.
| - to_slice() gives the equivalent slice.
| - str() and repr() allow printing.
| - indices(n) is like slice.indices(n).
|
| Methods defined here:
|
| __add__(self, other: 'PageRange') -> 'PageRange'
|
| __eq__(self, other: object) -> bool
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __init__(self, arg: Union[slice, ForwardRef('PageRange'), str]) -> None
| Initialize with either a slice -- giving the equivalent page range,
| or a PageRange object -- making a copy,
| or a string like
| "int", "[int]:[int]" or "[int]:[int]:[int]",
| where the brackets indicate optional ints.
| Remember, page indices start with zero.
| Page range expression examples:
|
| : all pages. -1 last page.
| 22 just the 23rd page. :-1 all but the last page.
| 0:3 the first three pages. -2 second-to-last page.
| :3 the first three pages. -2: last two pages.
| 5: from the sixth page onward. -3:-1 third & second to last.
| The third, "stride" or "step" number is also recognized.
| ::2 0 2 4 ... to the end. 3:0:-1 3 2 1 but not 0.
| 1:10:2 1 3 5 7 9 2::-1 2 1 0.
| ::-1 all pages in reverse order.
| Note the difference between this notation and arguments to slice():
| slice(3) means the first three pages;
| PageRange("3") means the range of only the fourth page.
| However PageRange(slice(3)) means the first three pages.
|
| __repr__(self) -> str
| A string like "PageRange('1:2:3')".
|
| __str__(self) -> str
| A string like "1:2:3".
|
| indices(self, n: int) -> tuple[int, int, int]
| Assuming a sequence of length n, calculate the start and stop indices,
| and the stride length of the PageRange.
|
| See help(slice.indices).
|
| Args:
| n: the length of the list of pages to choose from.
|
| Returns:
| Arguments for range().
|
| to_slice(self) -> slice
| Return the slice equivalent of this page range.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| valid(input: Any) -> bool
| True if input is a valid initializer for a PageRange.
|
| Args:
| input: A possible PageRange string or a PageRange object.
|
| Returns:
| True, if the ``input`` is a valid PageRange.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
parse_filename_page_ranges(args: list[typing.Union[str, pypdf.pagerange.PageRange, NoneType]]) -> list[tuple[str, pypdf.pagerange.PageRange]]
Given a list of filenames and page ranges, return a list of (filename, page_range) pairs.
Args:
args: A list where the first element is a filename. The other elements are
filenames, page-range expressions, slice objects, or PageRange objects.
A filename not followed by a page range indicates all pages of the file.
Returns:
A list of (filename, page_range) pairs.
DATA
PAGE_RANGE_ALL = PageRange(':')
PAGE_RANGE_RE = r'^((0|-?[1-9]\d*)|((0|-?[1-9]\d*)?(:(0|-?[1-9]\d*)?(:...
PageRangeSpec = typing.Union[str, pypdf.pagerange.PageRange, tuple[int...
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\pagerange.py
pypdf.papersizes
Python Library Documentation: module pypdf.papersizes in pypdf
NAME
pypdf.papersizes - Helper to get paper sizes.
CLASSES
builtins.object
PaperSize
builtins.tuple(builtins.object)
Dimensions
class Dimensions(builtins.tuple)
| Dimensions(width: int, height: int)
|
| Dimensions(width, height)
|
| Method resolution order:
| Dimensions
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.Dimensions
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.Dimensions
| Return a nicely formatted representation string
|
| _asdict(self) from collections.Dimensions
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.Dimensions
| Return a new Dimensions object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.Dimensions
| Make a new Dimensions object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, width: int, height: int) from namedtuple_Dimensions.Dimensions
| Create new instance of Dimensions(width, height)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| width
| Alias for field number 0
|
| height
| Alias for field number 1
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'height': <class 'int'>, 'width': <class 'int'>}
|
| __match_args__ = ('width', 'height')
|
| __orig_bases__ = (<function NamedTuple>,)
|
| _field_defaults = {}
|
| _fields = ('width', 'height')
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class PaperSize(builtins.object)
| (width, height) of the paper in portrait mode in pixels at 72 ppi.
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| A0 = Dimensions(width=2384, height=3370)
|
| A1 = Dimensions(width=1684, height=2384)
|
| A2 = Dimensions(width=1191, height=1684)
|
| A3 = Dimensions(width=842, height=1191)
|
| A4 = Dimensions(width=595, height=842)
|
| A5 = Dimensions(width=420, height=595)
|
| A6 = Dimensions(width=298, height=420)
|
| A7 = Dimensions(width=210, height=298)
|
| A8 = Dimensions(width=147, height=210)
|
| C4 = Dimensions(width=649, height=918)
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\papersizes.py
pypdf.parse_filename_page_ranges
Python Library Documentation: function parse_filename_page_ranges in module pypdf.pagerange
parse_filename_page_ranges(args: list[typing.Union[str, pypdf.pagerange.PageRange, NoneType]]) -> list[tuple[str, pypdf.pagerange.PageRange]]
Given a list of filenames and page ranges, return a list of (filename, page_range) pairs.
Args:
args: A list where the first element is a filename. The other elements are
filenames, page-range expressions, slice objects, or PageRange objects.
A filename not followed by a page range indicates all pages of the file.
Returns:
A list of (filename, page_range) pairs.
pypdf.pil_version
Error rendering doc: No Python documentation found for '12.3.0'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
pypdf.types
Python Library Documentation: module pypdf.types in pypdf
NAME
pypdf.types - Helpers for working with PDF types.
DATA
AnnotationSubtype = typing.Literal['/Text', '/Link', '/FreeText', '/.....
BorderArrayType = list[typing.Union[pypdf.generic._base.NameObject...e...
FitType = typing.Literal['/XYZ', '/Fit', '/FitH', '/FitV', '/FitR', '/...
LayoutType = typing.Literal['/NoLayout', '/SinglePage', '/One...TwoCol...
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
OutlineItemType = typing.Union[pypdf.generic._outline.OutlineItem, pyp...
OutlineType = list[typing.Union[pypdf.generic._data_structures...t[pyp...
PagemodeType = typing.Literal['/UseNone', '/UseOutlines', '/UseThumbs'...
TypeAlias = typing.TypeAlias
Special form for marking type aliases.
Use TypeAlias to indicate that an assignment should
be recognized as a proper type alias definition by type
checkers.
For example::
Predicate: TypeAlias = Callable[..., bool]
It's invalid when used anywhere except as in the example above.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
ZoomArgType = typing.Union[pypdf.generic._base.NumberObject, pypdf.gen...
ZoomArgsType = list[typing.Union[pypdf.generic._base.NumberObject, pyp...
__annotations__ = {'AnnotationSubtype': typing.TypeAlias, 'BorderArray...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\types.py
pypdf.xmp
Python Library Documentation: module pypdf.xmp in pypdf
NAME
pypdf.xmp - Anything related to Extensible Metadata Platform (XMP) metadata.
DESCRIPTION
https://en.wikipedia.org/wiki/Extensible_Metadata_Platform
CLASSES
pypdf._protocols.XmpInformationProtocol(pypdf._protocols.PdfObjectProtocol)
XmpInformation(pypdf._protocols.XmpInformationProtocol, pypdf.generic._base.PdfObject)
pypdf.generic._base.PdfObject(pypdf._protocols.PdfObjectProtocol)
XmpInformation(pypdf._protocols.XmpInformationProtocol, pypdf.generic._base.PdfObject)
class XmpInformation(pypdf._protocols.XmpInformationProtocol, pypdf.generic._base.PdfObject)
| XmpInformation(stream: pypdf.generic._data_structures.ContentStream) -> None
|
| An object that represents Extensible Metadata Platform (XMP) metadata.
| Usually accessed by :py:attr:`xmp_metadata()<pypdf.PdfReader.xmp_metadata>`.
|
| Raises:
| PdfReadError: if XML is invalid
|
| Method resolution order:
| XmpInformation
| pypdf._protocols.XmpInformationProtocol
| pypdf.generic._base.PdfObject
| pypdf._protocols.PdfObjectProtocol
| typing.Protocol
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __init__(self, stream: pypdf.generic._data_structures.ContentStream) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| get_element(self, about_uri: str, namespace: str, name: str) -> collections.abc.Iterator[typing.Any]
|
| get_nodes_in_namespace(self, about_uri: str, namespace: str) -> collections.abc.Iterator[typing.Any]
|
| write_to_stream(self, stream: IO[Any], encryption_key: Union[NoneType, str, bytes] = None) -> None
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __subclasshook__ = _proto_hook(other) from typing
|
| create() -> 'XmpInformation'
| Create a new XmpInformation object with minimal structure.
|
| Returns:
| A new XmpInformation instance with empty metadata fields.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| custom_properties
| Retrieve custom metadata properties defined in the undocumented pdfx
| metadata schema.
|
| Returns:
| A dictionary of key/value items for custom metadata properties.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| dc_contributor
| Contributors to the resource (other than the authors).
|
| dc_coverage
| Text describing the extent or scope of the resource.
|
| dc_creator
| A sorted array of names of the authors of the resource, listed in order of precedence.
|
| dc_date
| A sorted array of dates of significance to the resource. The dates and times are in UTC.
|
| dc_description
| A language-keyed dictionary of textual descriptions of the content of the resource.
|
| dc_format
| The mime-type of the resource.
|
| dc_identifier
| Unique identifier of the resource.
|
| dc_language
| An unordered array specifying the languages used in the resource.
|
| dc_publisher
| An unordered array of publisher names.
|
| dc_relation
| An unordered array of text descriptions of relationships to other documents.
|
| dc_rights
| A language-keyed dictionary of textual descriptions of the rights the user has to this resource.
|
| dc_source
| Unique identifier of the work from which this resource was derived.
|
| dc_subject
| An unordered array of descriptive phrases or keywords that specify the topic of the content.
|
| dc_title
| A language-keyed dictionary of the title of the resource.
|
| dc_type
| An unordered array of textual descriptions of the document type.
|
| pdf_keywords
| An unformatted text string representing document keywords.
|
| pdf_pdfversion
| The PDF file version, for example 1.0 or 1.3.
|
| pdf_producer
| The name of the tool that saved the document as a PDF.
|
| pdfaid_conformance
| The conformance level within the PDF/A standard (e.g., 'A', 'B', 'U').
|
| pdfaid_part
| The part of the PDF/A standard that the document conforms to (e.g., 1, 2, 3).
|
| xmp_create_date
| The date and time the resource was originally created. Returned as a UTC datetime object.
|
| xmp_creator_tool
| The name of the first known tool used to create the resource.
|
| xmp_metadata_date
| The date and time that any metadata for this resource was last changed. Returned as a UTC datetime object.
|
| xmp_modify_date
| The date and time the resource was last modified. Returned as a UTC datetime object.
|
| xmpmm_document_id
| The common identifier for all versions and renditions of this resource.
|
| xmpmm_instance_id
| An identifier for a specific incarnation of a document, updated each time a file is saved.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from pypdf.generic._base.PdfObject:
|
| clone(self, pdf_dest: pypdf._protocols.PdfWriterProtocol, force_duplicate: bool = False, ignore_fields: Optional[collections.abc.Sequence[Union[str, int]]] = ()) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter).
|
| By default, this method will call ``_reference_clone`` (see ``_reference``).
|
|
| Args:
| pdf_dest: Target to clone to.
| force_duplicate: By default, if the object has already been cloned and referenced,
| the copy will be returned; when ``True``, a new copy will be created.
| (Default value = ``False``)
| ignore_fields: List/tuple of field names (for dictionaries) that will be ignored
| during cloning (applies to children duplication as well). If fields are to be
| considered for a limited number of levels, you have to add it as integer, for
| example ``[1,"/B","/TOTO"]`` means that ``"/B"`` will be ignored at the first
| level only but ``"/TOTO"`` on all levels.
|
| Returns:
| The cloned PdfObject
|
| get_object(self) -> Optional[ForwardRef('PdfObject')]
| Resolve indirect references.
|
| hash_bin(self) -> int
| Used to detect modified object.
|
| Returns:
| Hash considering type and value.
|
| hash_value(self) -> bytes
|
| hash_value_data(self) -> bytes
|
| replicate(self, pdf_dest: pypdf._protocols.PdfWriterProtocol) -> 'PdfObject'
| Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter)
| without ensuring links. This is used in clone_document_from_root with incremental = True.
|
| Args:
| pdf_dest: Target to clone to.
|
| Returns:
| The cloned PdfObject
|
| ----------------------------------------------------------------------
| Static methods inherited from pypdf.generic._base.PdfObject:
|
| hash_func = openssl_sha1(string=b'', *, usedforsecurity=True)
| Returns a sha1 hash object; optionally initialized with a string
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pypdf._protocols.PdfObjectProtocol:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from pypdf._protocols.PdfObjectProtocol:
|
| __protocol_attrs__ = {'_reference_clone', 'clone', 'get_object', 'hash...
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Protocol:
|
| __init_subclass__(*args, **kwargs)
| Function to initialize subclasses.
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __class_getitem__(...)
| Parameterizes a generic class.
|
| At least, parameterizing a generic class is the *main* thing this
| method does. For example, for some generic class `Foo`, this is called
| when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
|
| However, note that this method is also called when defining generic
| classes in the first place with `class Foo[T]: ...`.
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
DC_NAMESPACE = 'http://purl.org/dc/elements/1.1/'
K = ~K
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
PDFAID_NAMESPACE = 'http://www.aiim.org/pdfa/ns/id/'
PDFX_NAMESPACE = 'http://ns.adobe.com/pdfx/1.3/'
PDF_NAMESPACE = 'http://ns.adobe.com/pdf/1.3/'
RDF_NAMESPACE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
StreamType = typing.IO[typing.Any]
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
XMPMM_NAMESPACE = 'http://ns.adobe.com/xap/1.0/mm/'
XMP_MAX_ELEMENT_COUNT = 100000
XMP_MAX_INPUT_LENGTH = 5000000
XMP_NAMESPACE = 'http://ns.adobe.com/xap/1.0/'
hexdigits = '0123456789abcdefABCDEF'
iso8601 = re.compile('\n (?P<year>[0-9]{4})\n ... (?P<hour...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\pypdf\xmp.py