You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1307,27 +1307,27 @@ For details on **embedded files** refer to Appendix 3.
1307
1307
1308
1308
*(New in version 1.16.8)*
1309
1309
1310
-
PDF only: Return the definition of a PDF object. For details please refer to :meth:`Document.xrefObject`.
1310
+
PDF only: Return the definition of a PDF object.
1311
1311
1312
1312
.. method:: PDFCatalog()
1313
1313
1314
1314
*(New in version 1.16.8)*
1315
1315
1316
-
PDF only: Return the :data:`xref` of the PDF catalog (or root) object. For details please refer to :meth:`Document._getPDFroot`.
1316
+
PDF only: Return the :data:`xref` of the PDF catalog (or root) object.
1317
1317
1318
1318
1319
1319
.. method:: PDFTrailer(compressed=False)
1320
1320
1321
1321
*(New in version 1.16.8)*
1322
1322
1323
-
PDF only: Return the trailer of the PDF (UTF-8), which is usually located at the PDF file's end. For details please refer to :meth:`Document._getTrailerString`.
1323
+
PDF only: Return the trailer of the PDF (UTF-8), which is usually located at the PDF file's end.
1324
1324
1325
1325
1326
1326
.. method:: metadataXML()
1327
1327
1328
1328
*(New in version 1.16.8)*
1329
1329
1330
-
PDF only: Return the :data:`xref` of the document's XML metadata. For details please refer to :meth:`Document._getXmlMetadataXref`.
1330
+
PDF only: Return the :data:`xref` of the document's XML metadata.
1331
1331
1332
1332
.. method:: xrefStream(xref)
1333
1333
@@ -1517,7 +1517,7 @@ Clear metadata information. If you do this out of privacy / data protection conc
Copy file name to clipboardExpand all lines: docs/faq.rst
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1952,12 +1952,12 @@ If it is *False* or if you want to be on the safe side, pick one of the followin
1952
1952
1953
1953
* **Prepend** the missing stacking command by executing *fitz.TOOLS._insert_contents(page, b"q\n", False)*.
1954
1954
* **Append** an unstacking command by executing *fitz.TOOLS._insert_contents(page, b"\nQ", True)*.
1955
-
* Alternatively, just use :meth:`Page._wrapContents`, which executes the previous two functions.
1955
+
* Alternatively, just use :meth:`Page.wrap_contents`, which executes the previous two functions.
1956
1956
1957
1957
.. note:: If small incremental update deltas are a concern, this approach is the most effective. Other contents objects are not touched. The utility method creates two new PDF :data:`stream` objects and inserts them before, resp. after the page's other :data:`contents`. We therefore recommend the following snippet to get this situation under control:
1958
1958
1959
1959
>>> ifnot page._isWrapped:
1960
-
page._wrapContents()
1960
+
page.wrap_contents()
1961
1961
>>> # start inserting text, images or annotations here
1962
1962
1963
1963
--------------------------
@@ -2034,7 +2034,7 @@ How to Handle Object Streams
2034
2034
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2035
2035
Some object types contain additional data apart from their object definition. Examples are images, fonts, embedded files or commands describing the appearance of a page.
2036
2036
2037
-
Objects of these types are called "stream objects". PyMuPDF allows reading an object's stream via method :meth:`Document.xrefStream` with the object's :data:`xref` as an argument. And it is also possible to write back a modified version of a stream using :meth:`Document.updatefStream`.
2037
+
Objects of these types are called "stream objects". PyMuPDF allows reading an object's stream via method :meth:`Document.xrefStream` with the object's :data:`xref` as an argument. And it is also possible to write back a modified version of a stream using :meth:`Document.updateStream`.
2038
2038
2039
2039
Assume that the following snippet wants to read all streams of a PDF for whatever reason::
2040
2040
@@ -2044,9 +2044,9 @@ Assume that the following snippet wants to read all streams of a PDF for whateve
2044
2044
# do something with it (it is a bytes object or None)
2045
2045
# e.g. just write it back:
2046
2046
if stream:
2047
-
doc.updatefStream(xref, stream)
2047
+
doc.updateStream(xref, stream)
2048
2048
2049
-
:meth:`Document.xrefStream` automatically returns a stream decompressed as a bytes object -- and :meth:`Document.updatefStream` automatically compresses it (where beneficial).
2049
+
:meth:`Document.xrefStream` automatically returns a stream decompressed as a bytes object -- and :meth:`Document.updateStream` automatically compresses it (where beneficial).
2050
2050
2051
2051
----------------------------------
2052
2052
@@ -2125,11 +2125,11 @@ ID array File identifier consisting of two byte strings.
2125
2125
XRefStm int Offset of a cross-reference stream. See :ref:`AdobeManual` p. 109.
Copy file name to clipboardExpand all lines: docs/functions.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Yet others are handy, general-purpose utilities.
20
20
:meth:`ConversionTrailer` return trailer string for *getText* methods
21
21
:meth:`Document.del_xml_metadata` PDF only: remove XML metadata
22
22
:meth:`Document.set_xml_metadata` PDF only: remove XML metadata
23
-
:meth:`Document.delete_object` PDF only: delete an object
23
+
:meth:`Document._deleteObject` PDF only: delete an object
24
24
:meth:`Document.get_new_xref` PDF only: create and return a new :data:`xref` entry
25
25
:meth:`Document._getOLRootNumber` PDF only: return / create :data:`xref` of */Outline*
26
26
:meth:`Document.pdf_catalog` PDF only: return the :data:`xref` of the catalog
@@ -346,7 +346,7 @@ Yet others are handy, general-purpose utilities.
346
346
347
347
-----
348
348
349
-
.. method:: Document.delete_object(xref)
349
+
.. method:: Document._deleteObject(xref)
350
350
351
351
PDF only: Delete an object given by its cross reference number.
352
352
@@ -410,7 +410,7 @@ Yet others are handy, general-purpose utilities.
410
410
411
411
.. method:: Document.xml_metadata_xref()
412
412
413
-
Return the XML-based metadata :data:`xref` of the PDF if present -- also refer to :meth:`Document._delXmlMetadata`. You can use it to retrieve the content via :meth:`Document.xrefStream` and then work with it using some XML software.
413
+
Return the XML-based metadata :data:`xref` of the PDF if present -- also refer to :meth:`Document.del_xml_metadata`. You can use it to retrieve the content via :meth:`Document.xrefStream` and then work with it using some XML software.
414
414
415
415
:rtype: int
416
416
:returns::data:`xref` of PDF file level XML metadata -- or 0 if none exists.
@@ -521,9 +521,9 @@ Yet others are handy, general-purpose utilities.
521
521
522
522
PDF only: Clean and concatenate all :data:`contents` objects associated with this page. "Cleaning" includes syntactical corrections, standardizations and "pretty printing" of the contents stream. Discrepancies between :data:`contents` and :data:`resources` objects will also be corrected if sanitize is true. See :meth:`Page.getContents` for more details.
523
523
524
-
Changed in version 1.16.0 Annotations are no longer implicitely cleaned by this method. Use :meth:`Annot._cleanContents` separately.
524
+
Changed in version 1.16.0 Annotations are no longer implicitly cleaned by this method. Use :meth:`Annot.cleanContents` separately.
525
525
526
-
:arg bool sanitize: *(new in v1.17.6)* if true, synchronization between resources and their actual use in the contents object is snychronized. For example, if a font is not actually used for any text of the page, then it will be deleted from the ``/Resources/Font`` object.
526
+
:arg bool sanitize: *(new in v1.17.6)* if true, synchronization between resources and their actual use in the contents object is synchronized. For example, if a font is not actually used for any text of the page, then it will be deleted from the ``/Resources/Font`` object.
527
527
528
528
.. warning:: This is a complex function which may generate large amounts of new data and render old data unused. It is **not recommended** using it together with the **incremental save** option. Also note that the resulting singleton new */Contents* object is **uncompressed**. So you should save to a **new file** using options *"deflate=True, garbage=3"*.
0 commit comments