1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
Main objects
************
.. autoclass:: pikepdf.Pdf
:members:
.. function:: pikepdf.open
Alias for :meth:`pikepdf.Pdf.open`.
.. function:: pikepdf.new
Alias for :meth:`pikepdf.Pdf.new`.
.. class:: pikepdf.ObjectStreamMode
Options for saving streams within PDFs, which are more a compact
way of saving certain types of data that was added in PDF 1.5. All
modern PDF viewers support object streams, but some third party tools
and libraries cannot read them.
.. attribute:: disable
Disable the use of object streams. If any object streams exist in the
file, remove them when the file is saved.
.. attribute:: preserve
Preserve any existing object streams in the original file. This is
the default behavior.
.. attribute:: generate
Generate object streams.
.. class:: pikepdf.StreamDecodeLevel
Options for decoding streams within PDFs.
.. attribute:: none
Do not attempt to apply any filters. Streams
remain as they appear in the original file. Note that
uncompressed streams may still be compressed on output. You can
disable that by saving with ``.save(..., compress_streams=False)``.
.. attribute:: generalized
This is the default. libqpdf will apply
LZWDecode, ASCII85Decode, ASCIIHexDecode, and FlateDecode
filters on the input. When saved with
``compress_streams=True``, the default, the effect of this
is that streams filtered with these older and less efficient
filters will be recompressed with the Flate filter. As a
special case, if a stream is already compressed with
FlateDecode and ``compress_streams=True``, the original
compressed data will be preserved.
.. attribute:: specialized
In addition to uncompressing the
generalized compression formats, supported non-lossy
compression will also be be decoded. At present, this includes
the RunLengthDecode filter.
.. attribute:: all
In addition to generalized and non-lossy
specialized filters, supported lossy compression filters will
be applied. At present, this includes DCTDecode (JPEG)
compression. Note that compressing the resulting data with
DCTDecode again will accumulate loss, so avoid multiple
compression and decompression cycles. This is mostly useful for
(low-level) retrieving image data; see :class:`pikepdf.PdfImage` for
the preferred method.
.. autoclass:: pikepdf.Encryption
:noindex:
Object construction
===================
.. autoclass:: pikepdf.Object
:members:
.. autoclass:: pikepdf.Name
:members: __new__
.. autoclass:: pikepdf.String
:members: __new__
.. autoclass:: pikepdf.Array
:members: __new__
.. autoclass:: pikepdf.Dictionary
:members: __new__
.. autoclass:: pikepdf.Stream
:members: __new__
.. autoclass:: pikepdf.Operator
:members:
Common PDF data structures
==========================
.. autoclass:: pikepdf.Rectangle
:members:
Content stream elements
=======================
.. autoclass:: pikepdf.ContentStreamInstruction
:members:
Represents one complete instruction inside a content stream.
.. autoclass:: pikepdf.ContentStreamInlineImage
:members:
Represents an instruction to draw an inline image inside a content
stream.
pikepdf consolidates the BI-ID-EI sequence of operators, as appears in a PDF to
declare an inline image, and replaces them with a single virtual content stream
instruction with the operator "INLINE IMAGE".
Internal objects
================
These objects are returned by other pikepdf objects. They are part of the API,
but not intended to be created explicitly.
.. autoclass:: pikepdf._qpdf.PageList
:members:
A ``list``-like object enumerating a range of pages in a :class:`pikepdf.Pdf`.
It may be all of the pages or a subset.
.. autoclass:: pikepdf._qpdf._ObjectList
:members:
A ``list``-like object containing multiple ``pikepdf.Object``.
.. class:: pikepdf.ObjectType
Enumeration of object types. These values are used to implement
pikepdf's instance type checking. In the vast majority of cases it is more
pythonic to use ``isinstance(obj, pikepdf.Stream)`` or ``issubclass``.
These values are low-level and documented for completeness. They are exposed
through :attr:`pikepdf.Object._type_code`.
.. attribute:: uninitialized
An uninitialized object. If this appears, it is probably a bug.
.. attribute:: reserved
A temporary object used in creating circular references. Should not appear
in most cases.
.. attribute:: null
A PDF null. In most cases, nulls are automatically converted to ``None``,
so this should not appear.
.. attribute:: boolean
A PDF boolean. In most cases, booleans are automatically converted to
``bool``, so this should not appear.
.. attribute:: integer
A PDF integer. In most cases, integers are automatically converted to
``int``, so this should not appear. Unlike Python integers, PDF integers
are 32-bit signed integers.
.. attribute:: real
A PDF real. In most cases, reals are automatically convert to
:class:`decimal.Decimal`.
.. attribute:: string
A PDF string, meaning the object is a ``pikepdf.String``.
.. attribute:: name_
A PDF name, meaning the object is a ``pikepdf.Name``.
.. attribute:: array
A PDF array, meaning the object is a ``pikepdf.Array``.
.. attribute:: dictionary
A PDF dictionary, meaning the object is a ``pikepdf.Dictionary``.
.. attribute:: stream
A PDF stream, meaning the object is a ``pikepdf.Stream`` (and it also
has a dictionary).
.. attribute:: operator
A PDF operator, meaning the object is a ``pikepdf.Operator``.
.. attribute:: inlineimage
A PDF inline image, meaning the object is the data stream of an inline
image. It would be necessary to combine this with the implicit
dictionary to interpret the image correctly. pikepdf automatically
packages inline images into a more useful class, so this will not
generally appear.
Jobs
====
.. autoclass:: pikepdf.Job
:members:
:special-members: __init__
|