Skip to content

Commit 9a6a8a6

Browse files
committed
upload v1.17.0
1 parent 39f0bcb commit 9a6a8a6

25 files changed

+992
-854
lines changed

PKG-INFO

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 1.1
22
Name: PyMuPDF
3-
Version: 1.16.18
3+
Version: 1.17.0
44
Author: Ruikai Liu
55
Author-email: [email protected]
66
Maintainer: Jorj X. McKie
@@ -9,7 +9,7 @@ Home-page: https://github.com/pymupdf/PyMuPDF
99
Download-url: https://github.com/pymupdf/PyMuPDF
1010
Summary: PyMuPDF is a Python binding for the PDF rendering library MuPDF
1111
Description:
12-
Release date: April 22, 2020
12+
Release date: May 18, 2020
1313

1414
Authors
1515
=======
@@ -20,7 +20,7 @@ Description:
2020
Introduction
2121
============
2222

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".
2424

2525
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.
2626

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# PyMuPDF 1.16.18
1+
# PyMuPDF 1.17.0
22

33
![logo](https://github.com/pymupdf/PyMuPDF/blob/master/demo/pymupdf.jpg)
44

5-
Release date: April 22, 2020
5+
Release date: May 18, 2020
66

77
**Travis-CI:** [![Build Status](https://travis-ci.org/JorjMcKie/py-mupdf.svg?branch=master)](https://travis-ci.org/JorjMcKie/py-mupdf)
88

@@ -14,7 +14,7 @@ On **[PyPI](https://pypi.org/project/PyMuPDF)** since August 2016: [![](https://
1414

1515
# Introduction
1616

17-
This is **version 1.16.18 of PyMuPDF (formerly python-fitz)**, 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".
1818

1919
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.
2020

docs/changes.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
Change Logs
22
===============
33

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.
20+
* **Fixed** issue `#502 <https://github.com/pymupdf/PyMuPDF/issues/502>`_.
21+
* **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+
430
Changes in Version 1.16.18
531
---------------------------
632
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.
733

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.
935

1036
* **Fixed** issue `#493 <https://github.com/pymupdf/PyMuPDF/issues/493>`_. ``Pixmap(doc, xref)`` should now again correctly resemble the loaded image object.
1137
* **Fixed** issue `#488 <https://github.com/pymupdf/PyMuPDF/issues/488>`_. Widget names are now modifyable.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
# built documents.
4747
#
4848
# The full version, including alpha/beta/rc tags.
49-
release = "1.16.18"
49+
release = "1.17.0"
5050

5151
# The short X.Y version
5252
version = release

docs/document.rst

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ For addional details on **embedded files** refer to Appendix 3.
5656
:meth:`Document.setMetadata` PDF only: set the metadata
5757
:meth:`Document.setToC` PDF only: set the table of contents (TOC)
5858
: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
5961
:meth:`Document.updateStream` PDF only: replace stream source
6062
:meth:`Document.write` PDF only: writes the document to memory
6163
: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.
6769
:attr:`Document.isFormPDF` is this a Form PDF?
6870
:attr:`Document.isPDF` is this a PDF?
6971
:attr:`Document.isReflowable` is this a reflowable document?
72+
:attr:`Document.lastLocation` return (chapter, pno) of last page
7073
:attr:`Document.metadata` metadata
7174
:attr:`Document.name` filename of document
7275
:attr:`Document.needsPass` require password to access data?
@@ -148,15 +151,45 @@ For addional details on **embedded files** refer to Appendix 3.
148151
* bit 2 set => **owner** password authenticated
149152

150153

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)
152173

153174
Create a :ref:`Page` object for further processing (like rendering, text searching, etc.).
154175

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.
156183

157184
:rtype: :ref:`Page`
158185

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.
160193

161194
.. method:: reload_page(page)
162195

@@ -1000,3 +1033,5 @@ Other Examples
10001033
.. [#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.
10011034
10021035
.. [#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.

docs/irect.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ IRect is a rectangular bounding box similar to :ref:`Rect`, except that all corn
1515
:meth:`IRect.getRectArea` calculate rectangle area
1616
:meth:`IRect.intersect` common part with another rectangle
1717
:meth:`IRect.intersects` checks for non-empty intersection
18+
:meth:`IRect.morph` transform with a point and a matrix
1819
:meth:`IRect.norm` the Euclidean norm
1920
:meth:`IRect.normalize` makes a rectangle finite
2021
:attr:`IRect.bottom_left` bottom left point, synonym *bl*
@@ -92,6 +93,16 @@ IRect is a rectangular bounding box similar to :ref:`Rect`, except that all corn
9293

9394
:rtype: bool
9495

96+
.. method:: morph(point, matrix)
97+
98+
*(New in version 1.17.0)*
99+
100+
Return a new quad after applying a matrix to it using a pivotal point.
101+
102+
:arg point_like point: the pivotal point.
103+
:arg matrix_like matrix: the matrix.
104+
:returns: a new quad.
105+
95106
.. method:: norm()
96107

97108
*(New in version 1.16.0)*

0 commit comments

Comments
 (0)