Skip to content

Commit d036671

Browse files
committed
performance improvements
- predefined dictionary keys
1 parent 260eced commit d036671

14 files changed

+1066
-522
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.2
3+
Version: 1.16.3
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: September 12, 2019
12+
Release date: September 30, 2019
1313

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

23-
This is **version 1.16.2 of PyMuPDF**, a Python binding for `MuPDF <http://mupdf.com/>`_ - "a lightweight PDF and XPS viewer".
23+
This is **version 1.16.3 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PyMuPDF 1.16.2
1+
# PyMuPDF 1.16.3
22

33
![logo](https://github.com/pymupdf/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.16.2 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.16.3 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".
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

examples/PDF2TextBlocks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
"""
32
Created on Thu Dec 14 17:00:00 2017
43
@@ -15,30 +14,31 @@
1514
The input file name is provided as a parameter to this script (sys.argv[1])
1615
The output file name is input-filename + ".txt".
1716
18-
In an effort to ensure correct reading sequence, text blocks are sort in
19-
ascending vertical, then horizontal direction. Please note that this will not
20-
work for all pages.
17+
In an effort to ensure correct reading sequence, text blocks are sorted in
18+
ascending vertical, then horizontal direction.
19+
This should work for text in horizontal, left-to-right writing mode.
20+
Please make adjustments as appropriate in your case.
2121
"""
2222

2323
import fitz
2424
import sys
2525
from operator import itemgetter
2626

2727
assert len(sys.argv) == 2, "need filename as parameter"
28-
#==============================================================================
28+
# ==============================================================================
2929
# Main Program
30-
#==============================================================================
30+
# ==============================================================================
3131
ifile = sys.argv[1]
3232
ofile = ifile + ".txt"
3333

3434
doc = fitz.open(ifile)
3535
pages = len(doc)
3636

37-
fout = open(ofile,"w")
37+
fout = open(ofile, "wb")
3838

3939
for page in doc:
4040
blocks = page.getTextBlocks()
41-
sb = sorted(blocks, key = itemgetter(1, 0))
41+
sb = sorted(blocks, key=itemgetter(1, 0))
4242
for b in sb:
4343
fout.write(b[4].encode("utf-8"))
4444

examples/PDF2TextJS.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)