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
On **[PyPI](https://pypi.org/project/PyMuPDF)** since August 2016: [](https://pepy.tech/project/pymupdf)
8
8
@@ -60,11 +60,7 @@ Have a look at the basic [demos](https://github.com/pymupdf/PyMuPDF-Utilities/tr
60
60
Documentation is written using Sphinx and is available in various formats from the following sources. It currently is a combination of reference guide and user manual. For a **quick start** look at the [tutorial](https://pymupdf.readthedocs.io/en/latest/tutorial.html) and the [recipes](https://pymupdf.readthedocs.io/en/latest/faq.html) chapters.
61
61
62
62
* You can view it online at [Read the Docs](https://readthedocs.org/projects/pymupdf/). This site also provides download options for PDF.
63
-
<<<<<<< Updated upstream
64
-
* The search function on Read the Docs does not work for me currently. If you want a working searchable local version, please download a zipped HTML for [here](https://github.com/pymupdf/PyMuPDF-optional-material/tree/master/doc/pymupdf.zip).
65
-
=======
66
63
* The search function on Read the Docs does not work for me currently. If you want a working searchable local version, please download a zipped HTML from [here](https://github.com/pymupdf/PyMuPDF-optional-material/tree/master/doc/pymupdf.zip).
67
-
>>>>>>> Stashed changes
68
64
* Find a Windows help file [here](https://github.com/pymupdf/PyMuPDF-optional-material/tree/master/doc/PyMuPDF.chm).
69
65
70
66
The latest changelog can be viewed [here](https://pymupdf.readthedocs.io/en/latest/changes.html).
There are **no mandatory** external dependencies. However, some **optional features** become available if additional packages are installed:
80
+
There are **no mandatory** external dependencies. However, some **optional features** become available only if additional packages are installed:
85
81
86
82
*[Pillow](https://pypi.org/project/Pillow/) for using pillow image output directly from PyMuPDF
87
-
*[fontTools](https://pypi.org/project/fonttools/) for creating font subsets
88
-
*[pymupdf-fonts](https://pypi.org/project/pymupdf-fonts/) contains some nice fonts for your text output
89
-
*[Tesseract-OCR](https://github.com/tesseract-ocr/tesseract) for optical character recognition in images and document pages. Tesseract is separate software, not a Python package. To enable OCR functions in PyMuPDF, the system environment variable `"TESSDATA_PREFIX"` must be defined and contain the `tessdata` folder name of the Tesseract installation location
83
+
*[fontTools](https://pypi.org/project/fonttools/) for creating font subsets.
84
+
*[pymupdf-fonts](https://pypi.org/project/pymupdf-fonts/) contains some nice fonts for your text output.
85
+
*[Tesseract-OCR](https://github.com/tesseract-ocr/tesseract) for optical character recognition in images and document pages. Tesseract is separate software, not a Python package. To enable OCR functions in PyMuPDF, the system environment variable `"TESSDATA_PREFIX"` must be defined and contain the `tessdata` folder name of the Tesseract installation location.
90
86
91
87
92
88
Older wheels - also with support for older Python versions - can be found [here](https://github.com/pymupdf/PyMuPDF-Optional-Material/tree/master/wheels-upto-Py3.5>) and on PyPI.
Copy file name to clipboardExpand all lines: changes.rst
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,23 @@ Change Log
8
8
This patch version implements minor improvements for :ref:`Pixmap` and also some important fixes.
9
9
10
10
* **Fixed** `#1351 <https://github.com/pymupdf/PyMuPDF/discussions/1351>`_. Reverted code that introduced the memory growth in v1.18.15.
11
+
11
12
* **Fixed** `#1417 <https://github.com/pymupdf/PyMuPDF/discussions/1417>`_. Developped circumvention for growth of open file handles using :meth:`Document.insert_pdf`.
13
+
12
14
* **Fixed** `#1418 <https://github.com/pymupdf/PyMuPDF/discussions/1418>`_. Developped circumvention for memory growth using :meth:`Document.insert_pdf`.
15
+
13
16
* **Fixed** `#1430 <https://github.com/pymupdf/PyMuPDF/discussions/1430>`_. Developped circumvention for mass pixmap generations of document pages.
17
+
14
18
* **Fixed** `#1433 <https://github.com/pymupdf/PyMuPDF/discussions/1433>`_. Solves a bbox error for some Type 3 font in PyMuPDF text processing.
19
+
15
20
* **Added** :meth:`Pixmap.color_topusage` to determine the share of the most frequently used color. Solves `#1397 <https://github.com/pymupdf/PyMuPDF/discussions/1397>`_.
21
+
16
22
* **Added** :meth:`Pixmap.warp` which makes a new pixmap from a given arbitrary convex quad inside the pixmap.
23
+
24
+
* **Added** :attr:`Annot.irt_xref` and :meth:`Annot.set_irt_xref` to inquire or set the `/IRT` ("In Responde To") property of an annotation. Implements `#1450 <https://github.com/pymupdf/PyMuPDF/discussions/1450>`_.
25
+
17
26
* **Added** :meth:`Rect.torect` and :meth:`IRect.torect` which compute a matrix that transforms to a given other rectangle.
27
+
18
28
* **Changed** :meth:`Pixmap.color_count` to also return the count of each color.
19
29
* **Changed** :meth:`Page.get_texttrace` to also return correct span and character bboxes if ``span["dir"] != (1, 0)``.
Copy file name to clipboardExpand all lines: docs/changes.rst
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,23 @@ Change Log
8
8
This patch version implements minor improvements for :ref:`Pixmap` and also some important fixes.
9
9
10
10
* **Fixed** `#1351 <https://github.com/pymupdf/PyMuPDF/discussions/1351>`_. Reverted code that introduced the memory growth in v1.18.15.
11
+
11
12
* **Fixed** `#1417 <https://github.com/pymupdf/PyMuPDF/discussions/1417>`_. Developped circumvention for growth of open file handles using :meth:`Document.insert_pdf`.
13
+
12
14
* **Fixed** `#1418 <https://github.com/pymupdf/PyMuPDF/discussions/1418>`_. Developped circumvention for memory growth using :meth:`Document.insert_pdf`.
15
+
13
16
* **Fixed** `#1430 <https://github.com/pymupdf/PyMuPDF/discussions/1430>`_. Developped circumvention for mass pixmap generations of document pages.
17
+
14
18
* **Fixed** `#1433 <https://github.com/pymupdf/PyMuPDF/discussions/1433>`_. Solves a bbox error for some Type 3 font in PyMuPDF text processing.
19
+
15
20
* **Added** :meth:`Pixmap.color_topusage` to determine the share of the most frequently used color. Solves `#1397 <https://github.com/pymupdf/PyMuPDF/discussions/1397>`_.
21
+
16
22
* **Added** :meth:`Pixmap.warp` which makes a new pixmap from a given arbitrary convex quad inside the pixmap.
23
+
24
+
* **Added** :attr:`Annot.irt_xref` and :meth:`Annot.set_irt_xref` to inquire or set the `/IRT` ("In Responde To") property of an annotation. Implements `#1450 <https://github.com/pymupdf/PyMuPDF/discussions/1450>`_.
25
+
17
26
* **Added** :meth:`Rect.torect` and :meth:`IRect.torect` which compute a matrix that transforms to a given other rectangle.
27
+
18
28
* **Changed** :meth:`Pixmap.color_count` to also return the count of each color.
19
29
* **Changed** :meth:`Page.get_texttrace` to also return correct span and character bboxes if ``span["dir"] != (1, 0)``.
* Changed in v1.19.3 - as a fix to issue `#537 <https://github.com/pymupdf/PyMuPDF/issues/537>`_, form fields are always excluded.
1173
+
1172
1174
PDF only: Copy the page range **[from_page, to_page]** (including both) of PDF document *docsrc* into the current one. Inserts will start with page number *start_at*. Value -1 indicates default values. All pages thus copied will be rotated as specified. Links and annotations can be excluded in the target, see below. All page numbers are 0-based.
1173
1175
1174
1176
:arg docsrc: An opened PDF *Document* which must not be the current document. However, it may refer to the same underlying file.
@@ -1183,7 +1185,7 @@ For details on **embedded files** refer to Appendix 3.
1183
1185
:arg int rotate: All copied pages will be rotated by the provided value (degrees, integer multiple of 90).
1184
1186
1185
1187
:arg bool links: Choose whether (internal and external) links should be included in the copy. Default is *True*. Internal links to outside the copied page range are **always excluded**.
1186
-
:arg bool annots: *(new in version 1.16.1)* choose whether annotations should be included in the copy.
1188
+
:arg bool annots: *(new in version 1.16.1)* choose whether annotations should be included in the copy. *(Fixed in v1.19.3)* Form fields can never be copied.
1187
1189
:arg int show_progress: *(new in version 1.17.7)* specify an interval size greater zero to see progress messages on ``sys.stdout``. After each interval, a message like ``Inserted 30 of 47 pages.`` will be printed.
1188
1190
:arg int final: *(new in v1.18.0)* controls whether the list of already copied objects should be **dropped** after this method, default *True*. Set it to 0 except for the last one of multiple insertions from the same source PDF. This saves target file size and speeds up execution considerably.
Copy file name to clipboardExpand all lines: docs/irect.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ IRect is a rectangular bounding box, very similar to :ref:`Rect`, except that al
14
14
:meth:`IRect.intersect` common part with another rectangle
15
15
:meth:`IRect.intersects` checks for non-empty intersection
16
16
:meth:`IRect.morph` transform with a point and a matrix
17
-
:meth:`IRect.torect` the matrix that converts to another rectangle
17
+
:meth:`IRect.torect` matrix that transforms to another rectangle
18
18
:meth:`IRect.norm` the Euclidean norm
19
19
:meth:`IRect.normalize` makes a rectangle finite
20
20
:attr:`IRect.bottom_left` bottom left point, synonym *bl*
@@ -89,11 +89,11 @@ IRect is a rectangular bounding box, very similar to :ref:`Rect`, except that al
89
89
90
90
*(New in version 1.19.3)*
91
91
92
-
Compute the matrix which transform this rectangle to a given one. See same-naed method of :ref:`Rect`.
92
+
Compute the matrix which transforms this rectangle to a given one. See :meth:`Rect.torect`.
93
93
94
94
:arg rect_like rect: the target rectangle. Must not be empty or infinite.
95
95
:rtype::ref:`Matrix`
96
-
:returns: a matrix ``mat`` such ``self * mat = rect``. Can for example be used to switch between page coordinates and corresponding positions of its pixmap.
96
+
:returns: a matrix ``mat`` such that ``self * mat = rect``. Can for example be used to transform between the page and the pixmap coordinates.
@@ -183,26 +183,28 @@ The following remarks are also valid for :ref:`IRect` objects:
183
183
184
184
*(New in version 1.19.3)*
185
185
186
-
Compute the matrix which transform this rectangle to a given one.
186
+
Compute the matrix which transforms this rectangle to a given one.
187
187
188
188
:arg rect_like rect: the target rectangle. Must not be empty or infinite.
189
189
:rtype::ref:`Matrix`
190
-
:returns: a matrix ``mat`` such ``self * mat = rect``. Can for example be used to switch between page coordinates and corresponding positions of its pixmap.
190
+
:returns: a matrix ``mat`` such that ``self * mat = rect``. Can for example be used to transform between the page and the pixmap coordinates.
191
191
192
-
.. note:: Suppose you want to check whether any of the words "pixmap" is located in an area with the same color as the text (e.g. white on white). We can find out whether the text's area mostly consists of pixels of identical color:
192
+
.. note:: Suppose you want to check whether any of the words "pixmap" is invisible, because the text color equals the ambient color -- e.g. white on white. We make a pixmap and check the "color environment" of each word:
193
193
194
+
>>> # make a pixmap of the page
194
195
>>> pix = page.get_pixmap(dpi=150)
196
+
>>> # make a matrix that transforms to pixmap coordinates
195
197
>>> mat = page.rect.torect(pix.irect)
196
-
>>> #"mat" converts page coordinates to pixmap coordinates
198
+
>>> #search for text locations
197
199
>>> rlist = page.search_for("pixmap")
198
-
>>> #then the following makes rectangles on the page's pixmap,
199
-
>>> #wich each encircle one "pixmap" occurrence:
200
+
>>> #check color environment of each occurrence
201
+
>>> #we will check for "almost unicolor"
200
202
>>> for r in rlist:
201
203
if pix.color_topusage(clip=r * mat) > 0.95:
202
-
print("Word 'pixmap' is invisible!")
204
+
print("'pixmap' invisible here:", r)
203
205
>>>
204
206
205
-
Method :meth:`Pixmap.color_topusage` computes the percentage of pixels showing the same color.
207
+
Method :meth:`Pixmap.color_topusage` computes the percentage of pixels showing the same color.
This documentation covers PyMuPDF v1.19.2 features as of **2021-11-20 00:00:01**.
4
+
This documentation covers PyMuPDF v1.19.3 features as of **2021-12-12 06:51:56**.
5
5
6
6
.. note:: The major and minor versions of **PyMuPDF** and **MuPDF** will always be the same. Only the third qualifier (patch level) may deviate from that of MuPDF.
0 commit comments