Skip to content

Commit 70691fc

Browse files
authored
Merge pull request #250 from JorjMcKie/master
upgrade to v1.14.7
2 parents ecb0fb0 + 0b6c02e commit 70691fc

File tree

11 files changed

+412
-226
lines changed

11 files changed

+412
-226
lines changed

PKG-INFO

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Metadata-Version: 1.1
2+
Name: PyMuPDF
3+
Version: 1.14.7
4+
Author: Ruikai Liu
5+
Author-email: [email protected]
6+
Maintainer: Ruikai Liu
7+
Maintainer-email: [email protected]
8+
Home-page: https://github.com/rk700/PyMuPDF
9+
Download-url: https://github.com/rk700/PyMuPDF
10+
Summary: PyMuPDF is a Python binding for the PDF rendering library MuPDF
11+
Description:
12+
13+
Release date: January 15, 2019
14+
15+
Authors
16+
=======
17+
18+
* Ruikai Liu
19+
* Jorj X. McKie
20+
21+
Introduction
22+
============
23+
24+
This is **version 1.14.7 of PyMuPDF**, a Python binding for `MuPDF <http://mupdf.com/>`_ - "a lightweight PDF and XPS viewer".
25+
26+
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.
27+
28+
With PyMuPDF you therefore can access files with extensions ``*.pdf``, ``*.xps``, ``*.oxps``, ``*.epub``, ``*.cbz`` or ``*.fb2`` from your Python scripts. A number of popular image formats is supported as well, including multi-page TIFF images.
29+
30+
PyMuPDF should run on all platforms that are supported by both, MuPDF and Python. These include, but are not limited to, Windows (XP/SP2 and up), Mac OS and Linux, 32-bit or 64-bit. If you can generate MuPDF on a Python supported platform, then also PyMuPDF can be used there.
31+
32+
PyMuPDF is hosted on `GitHub <https://github.com/rk700/PyMuPDF>`_ where you find up-to-date information of its features, our `issue tracker <https://github.com/rk700/PyMuPDF/issues>`_, `Wikis <https://github.com/rk700/PyMuPDF/wiki>`_ and much more.
33+
34+
Installation
35+
============
36+
37+
For all MS Windows versions as well as popular Max OS and Linux versions, we are providing Python wheels - see the download section of this site and the current `release directory <https://github.com/rk700/PyMuPDF/releases/latest>`_ of our home page. For Windows users, `zip-based installation <https://github.com/JorjMcKie/PyMuPDF-Optional-Material>`_ options are also available. Other platforms need to download and generate the MuPDF library first and then set up PyMuPDF. Do visit our GitHub home, which has more details on this, including latest bugfixes, pre-releases, etc.
38+
39+
Usage and Documentation
40+
========================
41+
42+
For all document types you can render pages in raster (PNG) or vector (SVG) formats, extract text and access meta information, links, annotations and bookmarks, as well as decrypt the document. For PDF files, most of these objects can also be created, modified or deleted. Plus you can rotate, re-arrange, duplicate, create, or delete pages and join or split documents.
43+
44+
Specifically for PDF files, PyMuPDF provides update access to low-level structure information, supports handling of embedded files and modification of page contents (like inserting images, fonts, text, annotations and drawings). When saving changes to password protected PDFs you can now choose, whether to keep or remove encryption.
45+
46+
Other features include embedding vector images (SVG, PDF) such as logos or watermarks, joining or splitting single PDF pages (including things like posterizing and 2-up / 4-up processing).
47+
48+
You can now also create **PDF Form fields** with support for text, checkbox, listbox and combobox widgets.
49+
50+
Our home page provides many examples and How-Tos for all of this. At a minimum, read the tutorial and the the recipes sections of our documentation.
51+
52+
Written using **Sphinx**, documentation is available here:
53+
54+
* View it online at `Read The Docs <https://pymupdf.readthedocs.io/en/latest/>`_. For **best quality downloads**, use the following links.
55+
56+
* `HTML <https://github.com/rk700/PyMuPDF/tree/master/doc/html.zip>`_
57+
58+
* `Windows CHM <https://github.com/JorjMcKie/PyMuPDF-optional-material/tree/master/doc/PyMuPDF.chm>`_
59+
60+
* `PDF <https://github.com/rk700/PyMuPDF/tree/master/doc/pymupdf.pdf>`_
61+
62+
63+
Classifier: Development Status :: 5 - Production/Stable
64+
Classifier: Environment :: Console
65+
Classifier: Intended Audience :: Developers
66+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
67+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
68+
Classifier: Operating System :: MacOS
69+
Classifier: Operating System :: Microsoft :: Windows
70+
Classifier: Operating System :: POSIX :: Linux
71+
Classifier: Programming Language :: C
72+
Classifier: Programming Language :: Python :: 2.7
73+
Classifier: Programming Language :: Python :: 3
74+
Classifier: Programming Language :: Python :: 3.4
75+
Classifier: Programming Language :: Python :: 3.5
76+
Classifier: Programming Language :: Python :: 3.6
77+
Classifier: Programming Language :: Python :: 3.7
78+
Classifier: Topic :: Utilities

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PyMuPDF 1.14.6
1+
# PyMuPDF 1.14.7
22

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

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

1515
# Introduction
1616

17-
This is **version 1.14.6 of PyMuPDF (formerly python-fitz)**, a Python binding with support for [MuPDF 1.14.x](http://mupdf.com/) - "a lightweight PDF, XPS, and E-book viewer".
17+
This is **version 1.14.7 of PyMuPDF (formerly python-fitz)**, a Python binding with support for [MuPDF 1.14.x](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

fitz/fitz.i

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6352,6 +6352,12 @@ struct Tools
63526352
JM_point_from_py(p)));
63536353
}
63546354
6355+
%feature("autodoc","Transform point with matrix.") _transform_point;
6356+
PyObject *_transform_point(PyObject *point, PyObject *matrix)
6357+
{
6358+
return JM_py_from_point(fz_transform_point(JM_point_from_py(point), JM_matrix_from_py(matrix)));
6359+
}
6360+
63556361
%feature("autodoc","Replace r1 with smallest rect containing both.") _union_rect;
63566362
PyObject *_union_rect(PyObject *r1, PyObject *r2)
63576363
{
@@ -6389,15 +6395,24 @@ struct Tools
63896395
}
63906396
63916397
%feature("autodoc","Measure length of a string for a Base14 font.") measure_string;
6392-
float measure_string(const char *text, const char *fontname, float fontsize)
6398+
float measure_string(const char *text, const char *fontname, float fontsize,
6399+
int encoding = 0)
63936400
{
63946401
fz_font *font = fz_new_base14_font(gctx, fontname);
63956402
float w = 0;
63966403
while (*text)
63976404
{
63986405
int c, g;
63996406
text += fz_chartorune(&c, text);
6400-
c = pdf_winansi_from_unicode(c);
6407+
switch (encoding)
6408+
{
6409+
case PDF_SIMPLE_ENCODING_GREEK:
6410+
c = pdf_greek_from_unicode(c); break;
6411+
case PDF_SIMPLE_ENCODING_CYRILLIC:
6412+
c = pdf_cyrillic_from_unicode(c); break;
6413+
default:
6414+
c = pdf_winansi_from_unicode(c); break;
6415+
}
64016416
if (c < 0) c = 0xB7;
64026417
g = fz_encode_character(gctx, font, c);
64036418
w += fz_advance_glyph(gctx, font, g, 0);
@@ -6440,7 +6455,7 @@ def _oval_string(self, p1, p2, p3, p4):
64406455
"""Return /AP string defining an oval within a 4-polygon provided as points
64416456
"""
64426457
def bezier(p, q, r):
6443-
f = "%g %g %g %g %g %g c\n"
6458+
f = "%f %f %f %f %f %f c\n"
64446459
return f % (p.x, p.y, q.x, q.y, r.x, r.y)
64456460
64466461
kappa = 0.55228474983 # magic number
@@ -6457,7 +6472,7 @@ def _oval_string(self, p1, p2, p3, p4):
64576472
ul1 = mu + (p4 - mu) * kappa
64586473
ul2 = ml + (p4 - ml) * kappa
64596474
# now draw, starting from middle point of left side
6460-
ap = "%g %g m\n" % (ml.x, ml.y)
6475+
ap = "%f %f m\n" % (ml.x, ml.y)
64616476
ap += bezier(ol1, ol2, mo)
64626477
ap += bezier(or1, or2, mr)
64636478
ap += bezier(ur1, ur2, mu)
@@ -6474,13 +6489,13 @@ def _le_diamond(self, annot, p1, p2, lr):
64746489
r = Rect(M, M) + (-d, -d, d, d) # the square
64756490
# the square makes line longer by (2*shift - 1)*width
64766491
p = (r.tl + (r.bl - r.tl) * 0.5) * im
6477-
ap = "q\n%s%g %g m\n" % (opacity, p.x, p.y)
6492+
ap = "q\n%s%f %f m\n" % (opacity, p.x, p.y)
64786493
p = (r.tl + (r.tr - r.tl) * 0.5) * im
6479-
ap += "%g %g l\n" % (p.x, p.y)
6494+
ap += "%f %f l\n" % (p.x, p.y)
64806495
p = (r.tr + (r.br - r.tr) * 0.5) * im
6481-
ap += "%g %g l\n" % (p.x, p.y)
6496+
ap += "%f %f l\n" % (p.x, p.y)
64826497
p = (r.br + (r.bl - r.br) * 0.5) * im
6483-
ap += "%g %g l\n" % (p.x, p.y)
6498+
ap += "%f %f l\n" % (p.x, p.y)
64846499
ap += "%g w\n" % w
64856500
ap += scol + fcol + "b\nQ\n"
64866501
return ap
@@ -6495,13 +6510,13 @@ def _le_square(self, annot, p1, p2, lr):
64956510
r = Rect(M, M) + (-d, -d, d, d) # the square
64966511
# the square makes line longer by (2*shift - 1)*width
64976512
p = r.tl * im
6498-
ap = "q\n%s%g %g m\n" % (opacity, p.x, p.y)
6513+
ap = "q\n%s%f %f m\n" % (opacity, p.x, p.y)
64996514
p = r.tr * im
6500-
ap += "%g %g l\n" % (p.x, p.y)
6515+
ap += "%f %f l\n" % (p.x, p.y)
65016516
p = r.br * im
6502-
ap += "%g %g l\n" % (p.x, p.y)
6517+
ap += "%f %f l\n" % (p.x, p.y)
65036518
p = r.bl * im
6504-
ap += "%g %g l\n" % (p.x, p.y)
6519+
ap += "%f %f l\n" % (p.x, p.y)
65056520
ap += "%g w\n" % w
65066521
ap += scol + fcol + "b\nQ\n"
65076522
return ap
@@ -6528,8 +6543,8 @@ def _le_butt(self, annot, p1, p2, lr):
65286543
M = R if lr else L
65296544
top = (M + (0, -d/2.)) * im
65306545
bot = (M + (0, d/2.)) * im
6531-
ap = "\nq\n%s%g %g m\n" % (opacity, top.x, top.y)
6532-
ap += "%g %g l\n" % (bot.x, bot.y)
6546+
ap = "\nq\n%s%f %f m\n" % (opacity, top.x, top.y)
6547+
ap += "%f %f l\n" % (bot.x, bot.y)
65336548
ap += "%g w\n" % w
65346549
ap += scol + "s\nQ\n"
65356550
return ap
@@ -6543,8 +6558,8 @@ def _le_slash(self, annot, p1, p2, lr):
65436558
r = Rect(M.x - rw, M.y - 2 * w, M.x + rw, M.y + 2 * w)
65446559
top = r.tl * im
65456560
bot = r.br * im
6546-
ap = "\nq\n%s%g %g m\n" % (opacity, top.x, top.y)
6547-
ap += "%g %g l\n" % (bot.x, bot.y)
6561+
ap = "\nq\n%s%f %f m\n" % (opacity, top.x, top.y)
6562+
ap += "%f %f l\n" % (bot.x, bot.y)
65486563
ap += "%g w\n" % w
65496564
ap += scol + "s\nQ\n"
65506565
return ap
@@ -6561,9 +6576,9 @@ def _le_openarrow(self, annot, p1, p2, lr):
65616576
p1 *= im
65626577
p2 *= im
65636578
p3 *= im
6564-
ap = "\nq\n%s%g %g m\n" % (opacity, p1.x, p1.y)
6565-
ap += "%g %g l\n" % (p2.x, p2.y)
6566-
ap += "%g %g l\n" % (p3.x, p3.y)
6579+
ap = "\nq\n%s%f %f m\n" % (opacity, p1.x, p1.y)
6580+
ap += "%f %f l\n" % (p2.x, p2.y)
6581+
ap += "%f %f l\n" % (p3.x, p3.y)
65676582
ap += "%g w\n" % w
65686583
ap += scol + "S\nQ\n"
65696584
return ap
@@ -6580,9 +6595,9 @@ def _le_closedarrow(self, annot, p1, p2, lr):
65806595
p1 *= im
65816596
p2 *= im
65826597
p3 *= im
6583-
ap = "\nq\n%s%g %g m\n" % (opacity, p1.x, p1.y)
6584-
ap += "%g %g l\n" % (p2.x, p2.y)
6585-
ap += "%g %g l\n" % (p3.x, p3.y)
6598+
ap = "\nq\n%s%f %f m\n" % (opacity, p1.x, p1.y)
6599+
ap += "%f %f l\n" % (p2.x, p2.y)
6600+
ap += "%f %f l\n" % (p3.x, p3.y)
65866601
ap += "%g w\n" % w
65876602
ap += scol + fcol + "b\nQ\n"
65886603
return ap
@@ -6599,9 +6614,9 @@ def _le_ropenarrow(self, annot, p1, p2, lr):
65996614
p1 *= im
66006615
p2 *= im
66016616
p3 *= im
6602-
ap = "\nq\n%s%g %g m\n" % (opacity, p1.x, p1.y)
6603-
ap += "%g %g l\n" % (p2.x, p2.y)
6604-
ap += "%g %g l\n" % (p3.x, p3.y)
6617+
ap = "\nq\n%s%f %f m\n" % (opacity, p1.x, p1.y)
6618+
ap += "%f %f l\n" % (p2.x, p2.y)
6619+
ap += "%f %f l\n" % (p3.x, p3.y)
66056620
ap += "%g w\n" % w
66066621
ap += scol + fcol + "S\nQ\n"
66076622
return ap
@@ -6618,9 +6633,9 @@ def _le_rclosedarrow(self, annot, p1, p2, lr):
66186633
p1 *= im
66196634
p2 *= im
66206635
p3 *= im
6621-
ap = "\nq\n%s%g %g m\n" % (opacity, p1.x, p1.y)
6622-
ap += "%g %g l\n" % (p2.x, p2.y)
6623-
ap += "%g %g l\n" % (p3.x, p3.y)
6636+
ap = "\nq\n%s%f %f m\n" % (opacity, p1.x, p1.y)
6637+
ap += "%f %f l\n" % (p2.x, p2.y)
6638+
ap += "%f %f l\n" % (p3.x, p3.y)
66246639
ap += "%g w\n" % w
66256640
ap += scol + fcol + "b\nQ\n"
66266641
return ap

0 commit comments

Comments
 (0)