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
Summary: PyMuPDF is a Python binding for the PDF rendering library MuPDF
11
11
Description:
12
-
Release date: April 22, 2020
12
+
Release date: May 18, 2020
13
13
14
14
Authors
15
15
=======
@@ -20,7 +20,7 @@ Description:
20
20
Introduction
21
21
============
22
22
23
-
This is **version 1.16.18 of PyMuPDF**, a Python binding for `MuPDF <http://mupdf.com/>`_ - "a lightweight PDF and XPS viewer".
23
+
This is **version 1.17.0 of PyMuPDF**, a Python binding for `MuPDF <http://mupdf.com/>`_ - "a lightweight PDF and XPS viewer".
24
24
25
25
MuPDF can access files in PDF, XPS, OpenXPS, epub, comic and fiction book formats, and it is known for both, its top performance and high rendering quality.
@@ -14,7 +14,7 @@ On **[PyPI](https://pypi.org/project/PyMuPDF)** since August 2016: [**, a Python binding with support for [MuPDF 1.16.*](http://mupdf.com/) - "a lightweight PDF, XPS, and E-book viewer".
17
+
This is **version 1.17.0 of PyMuPDF (formerly python-fitz)**, a Python binding with support for [MuPDF 1.17.*](http://mupdf.com/) - "a lightweight PDF, XPS, and E-book viewer".
18
18
19
19
MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB and FB2 (e-books) formats, and it is known for its top performance and high rendering quality.
Copy file name to clipboardExpand all lines: docs/changes.rst
+27-1Lines changed: 27 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,37 @@
1
1
Change Logs
2
2
===============
3
3
4
+
Changes in Version 1.17.0
5
+
---------------------------
6
+
This version is based on MuPDF v1.17. Following are highlights of new and changed features:
7
+
8
+
* **Added** extended language support for annotations and widgets: a mixture of Latin, Greece, Russian, Chinese, Japanese and Korean characters can now be used in 'FreeText' annotations and text widgets. No special arrangement is required to use it.
9
+
10
+
* Faster page access is implemented for documents supporting a "chapter" structure. This applies to EPUB documents currently. This comes with several new :ref:`Document` methods and changes for :meth:`Document.loadPage` and the "indexed" page access *doc[n]*: In addition to specifying a page number as before, a tuple *(chaper, pno)* can be specified to identify the desired page.
11
+
12
+
* **Changed:** Improved support of redaction annotations: images overlapped by redactions are **permanantly modified** by erasing the overlap areas. Also links are removed if overlapped by redactions. This is now fully in sync with PDF specifications.
13
+
14
+
Other changes:
15
+
16
+
* **Changed** :meth:`TextWriter.writeText` to support the *"morph"* parameter.
17
+
* **Added** methods :meth:`Rect.morph`, :meth:`IRect.morph`, and :meth:`Quad.morph`, which return a new :ref:`Quad`.
18
+
* **Changed** :meth:`Page.addFreetextAnnot` to support text alignment via a new *"align"* parameter.
19
+
* **Fixed** issue `#508 <https://github.com/pymupdf/PyMuPDF/issues/508>`_. Improved image rectangle calculation to hopefully deliver correct values in most if not all cases.
* **Fixed** issue `#500 <https://github.com/pymupdf/PyMuPDF/issues/500>`_. :meth:`Document.convertToPDF` should no longer cause memory leaks.
22
+
* **Fixed** issue `#496 <https://github.com/pymupdf/PyMuPDF/issues/496>`_. Annotations and widgets / fields are now added or modified using the coordinates of the **unrotated page**. This behavior is now in sync with other methods modifying PDF pages.
23
+
* **Added** :attr:`Page.rotationMatrix` and :attr:`Page.derotationMatrix` to support coordinate transformations between the rotated and the original versions of a PDF page.
24
+
25
+
Potential code breaking changes:
26
+
27
+
* The private method ``Page._getTransformation()`` has been removed. Use the public :attr:`Page.transformationMattrix` instead.
28
+
29
+
4
30
Changes in Version 1.16.18
5
31
---------------------------
6
32
This version introduces several new features around PDF text output. The motivation is to simplify this task, while at the same time offering extending features.
7
33
8
-
One major achievement is using MuPDF's capabilities to dynamically choosing fallback fonts whenever a character cannot be found in the predefined one. This seemlessly works for Base-14 fonts in combination with CJK fonts (China, Japan, Korea).
34
+
One major achievement is using MuPDF's capabilities to dynamically choosing fallback fonts whenever a character cannot be found in the current one. This seemlessly works for Base-14 fonts in combination with CJK fonts (China, Japan, Korea). So a text may contain **any combination of characters** from the Latin, Greek, Russian, Chinese, Japanese and Korean languages.
9
35
10
36
* **Fixed** issue `#493 <https://github.com/pymupdf/PyMuPDF/issues/493>`_. ``Pixmap(doc, xref)`` should now again correctly resemble the loaded image object.
11
37
* **Fixed** issue `#488 <https://github.com/pymupdf/PyMuPDF/issues/488>`_. Widget names are now modifyable.
Copy file name to clipboardExpand all lines: docs/document.rst
+38-3Lines changed: 38 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ For addional details on **embedded files** refer to Appendix 3.
56
56
:meth:`Document.setMetadata` PDF only: set the metadata
57
57
:meth:`Document.setToC` PDF only: set the table of contents (TOC)
58
58
:meth:`Document.updateObject` PDF only: replace object source
59
+
:meth:`Document.nextLocation` return (chapter, pno) of following page
60
+
:meth:`Document.previousLocation` return (chapter, pno) of preceeding page
59
61
:meth:`Document.updateStream` PDF only: replace stream source
60
62
:meth:`Document.write` PDF only: writes the document to memory
61
63
:meth:`Document.xrefObject` PDF only: object source at the :data:`xref`
@@ -67,6 +69,7 @@ For addional details on **embedded files** refer to Appendix 3.
67
69
:attr:`Document.isFormPDF` is this a Form PDF?
68
70
:attr:`Document.isPDF` is this a PDF?
69
71
:attr:`Document.isReflowable` is this a reflowable document?
72
+
:attr:`Document.lastLocation` return (chapter, pno) of last page
70
73
:attr:`Document.metadata` metadata
71
74
:attr:`Document.name` filename of document
72
75
:attr:`Document.needsPass` require password to access data?
@@ -148,15 +151,45 @@ For addional details on **embedded files** refer to Appendix 3.
148
151
* bit 2 set => **owner** password authenticated
149
152
150
153
151
-
.. method:: loadPage(pno=0)
154
+
.. method:: nextLocation(page_id)
155
+
156
+
*(New in v.1.17.0)* Return the locator of the following page.
157
+
158
+
:arg tuple page_id: the current page id. This must be a tuple *(chapter, pno)* identifying an existing page.
159
+
160
+
:returns: The tuple of the following page, i.e. either *(chapter, pno + 1)* or *(chapter + 1, 0)*, **or** the empty tuple *()* if the argument was the last page.
161
+
162
+
163
+
.. method:: previousLocation(page_id)
164
+
165
+
*(New in v.1.17.0)* Return the locator of the preceeding page.
166
+
167
+
:arg tuple page_id: the current page id. This must be a tuple *(chapter, pno)* identifying an existing page.
168
+
169
+
:returns: The tuple of the preceeding page, i.e. either *(chapter, pno - 1)* or the last page of the receeding chapter, **or** the empty tuple *()* if the argument was the first page.
170
+
171
+
172
+
.. method:: loadPage(page_id=0)
152
173
153
174
Create a :ref:`Page` object for further processing (like rendering, text searching, etc.).
154
175
155
-
:arg int pno: page number, zero-based (0 is default and the first page of the document). Any integer -inf < pno < pageCount is acceptable. If pno is negative, then :attr:`pageCount` will be added until this is no longer the case. For example: to load the last page, you can specify doc.loadPage(-1). After this you have page.number = doc.pageCount - 1.
176
+
*(Changed in v1.17.0)* For document types supporting a so-called "chapter structure" (like EPUB), pages can also be loaded via the combination of chapter number and relative page number, instead of the absolute page number. This should **significantly speed up access** for large documents.
177
+
178
+
:arg int,tuple page_id: *(Changed in v1.17.0)*
179
+
180
+
Either a 0-based page number, or a tuple *(chapter, pno)*. For an integer, any *-inf < page_id < pageCount* is acceptable. While page_id is negative, :attr:`pageCount` will be added to it. For example: to load the last page, you can use *doc.loadPage(-1)*. After this you have page.number = doc.pageCount - 1.
181
+
182
+
For a tuple, *chapter* must be in range :attr:`Document.chapterCount`, and *pno* must be in range :meth:`Document.chapterPageCount` of that chapter. Both values are 0-based. With this notation, :attr:`Page.number` will equal the given tuple.
156
183
157
184
:rtype::ref:`Page`
158
185
159
-
.. note:: Documents also follow the Python sequence protocol with page numbers as indices: *doc.loadPage(n) == doc[n]*. Consequently, expressions like *"for page in doc: ..."* and *"for page in reversed(doc): ..."* will successively yield the document's pages. Refer to :meth:`Document.pages` which allows processing pages as with slicing.
186
+
.. note::
187
+
188
+
Documents also follow the Python sequence protocol with page numbers as indices: *doc.loadPage(n) == doc[n]*. Consequently, expressions like *"for page in doc: ..."* and *"for page in reversed(doc): ..."* will successively yield the document's pages. Refer to :meth:`Document.pages` which allows processing pages as with slicing.
189
+
190
+
You can also use this notation with the new chapter-based page identification: use *page = doc[(5, 2)]* to load the third page of the sixth chapter.
191
+
192
+
For document types not supporting a chapter structure (like PDFs), :attr:`Document.chapterCount` is 1, and pages can alternatively be loaded via tuples *(0, pno)*. See this [#f3]_ footnote for comments on performance improvements.
160
193
161
194
.. method:: reload_page(page)
162
195
@@ -1000,3 +1033,5 @@ Other Examples
1000
1033
.. [#f1] Content streams describe what (e.g. text or images) appears where and how on a page. PDF uses a specialized mini language similar to PostScript to do this (pp. 985 in :ref:`AdobeManual`), which gets interpreted when a page is loaded.
1001
1034
1002
1035
.. [#f2] However, you **can** use :meth:`Document.getToC` and :meth:`Page.getLinks` (which are available for all document types) and copy this information over to the output PDF. See demo `pdf-converter.py <https://github.com/pymupdf/PyMuPDF-Utilities/tree/master/demo/pdf-converter.py>`_.
1036
+
1037
+
.. [f3] For applicable (layoutable) document types, loading a page via its absolute number may result in layouting a large part of the document, before the page can be accessed. To avoid this, prefer the chapter-based access. Use convenience methods / attributes :meth:`Document.nextLocation`, :meth:`Document.previousLocation` and :attr:`Document.lastLocation` for maintaining a high level of coding efficiency.
0 commit comments