Skip to content

Commit c3f4630

Browse files
committed
Fixing issues #147 and #148
1 parent 432ae25 commit c3f4630

File tree

12 files changed

+805
-704
lines changed

12 files changed

+805
-704
lines changed

README.md

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

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

@@ -10,7 +10,7 @@ Release date: December 31, 2017
1010

1111
# Introduction
1212

13-
This is **version 1.12.3 of PyMuPDF (formerly python-fitz)**, a Python binding which supports [MuPDF 1.12](http://mupdf.com/) - "a lightweight PDF and XPS viewer".
13+
This is **version 1.12.4 of PyMuPDF (formerly python-fitz)**, a Python binding which supports [MuPDF 1.12](http://mupdf.com/) - "a lightweight PDF and XPS viewer".
1414

1515
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.
1616

doc/PyMuPDF.pdf

8.85 KB
Binary file not shown.

doc/html.zip

1.35 KB
Binary file not shown.

fitz/fitz.i

Lines changed: 115 additions & 260 deletions
Large diffs are not rendered by default.

fitz/fitz.py

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ class _object:
102102

103103

104104
VersionFitz = "1.12.0"
105-
VersionBind = "1.12.3"
106-
VersionDate = "2018-03-01 02:35:55"
107-
version = (VersionBind, VersionFitz, "20180301023555")
105+
VersionBind = "1.12.4"
106+
VersionDate = "2018-03-18 10:18:03"
107+
version = (VersionBind, VersionFitz, "20180318101803")
108108

109109

110110
#------------------------------------------------------------------------------
@@ -704,8 +704,8 @@ def authenticate(self, arg2):
704704
return val
705705

706706

707-
def save(self, filename, garbage=0, clean=0, deflate=0, incremental=0, ascii=0, expand=0, linear=0):
708-
"""save(self, filename, garbage=0, clean=0, deflate=0, incremental=0, ascii=0, expand=0, linear=0) -> PyObject *"""
707+
def save(self, filename, garbage=0, clean=0, deflate=0, incremental=0, ascii=0, expand=0, linear=0, pretty=0):
708+
"""save(self, filename, garbage=0, clean=0, deflate=0, incremental=0, ascii=0, expand=0, linear=0, pretty=0) -> PyObject *"""
709709

710710
if self.isClosed:
711711
raise ValueError("operation illegal for closed doc")
@@ -721,16 +721,16 @@ def save(self, filename, garbage=0, clean=0, deflate=0, incremental=0, ascii=0,
721721
raise ValueError("incremental save needs original file")
722722

723723

724-
return _fitz.Document_save(self, filename, garbage, clean, deflate, incremental, ascii, expand, linear)
724+
return _fitz.Document_save(self, filename, garbage, clean, deflate, incremental, ascii, expand, linear, pretty)
725725

726726

727-
def write(self, garbage=0, clean=0, deflate=0, ascii=0, expand=0, linear=0):
727+
def write(self, garbage=0, clean=0, deflate=0, ascii=0, expand=0, linear=0, pretty=0):
728728
"""Write document to a bytes object."""
729729

730730
if self.isClosed:
731731
raise ValueError("operation illegal for closed doc")
732732

733-
return _fitz.Document_write(self, garbage, clean, deflate, ascii, expand, linear)
733+
return _fitz.Document_write(self, garbage, clean, deflate, ascii, expand, linear, pretty)
734734

735735

736736
def insertPDF(self, docsrc, from_page=-1, to_page=-1, start_at=-1, rotate=-1, links=1):
@@ -744,10 +744,9 @@ def insertPDF(self, docsrc, from_page=-1, to_page=-1, start_at=-1, rotate=-1, li
744744
sa = self.pageCount
745745

746746
val = _fitz.Document_insertPDF(self, docsrc, from_page, to_page, start_at, rotate, links)
747-
if val == 0:
748-
self._reset_page_refs()
749-
if links:
750-
self._do_links(docsrc, from_page = from_page, to_page = to_page,
747+
self._reset_page_refs()
748+
if links:
749+
self._do_links(docsrc, from_page = from_page, to_page = to_page,
751750
start_at = sa)
752751

753752
return val
@@ -759,7 +758,7 @@ def deletePage(self, pno):
759758
raise ValueError("operation illegal for closed doc")
760759

761760
val = _fitz.Document_deletePage(self, pno)
762-
if val == 0: self._reset_page_refs()
761+
self._reset_page_refs()
763762

764763
return val
765764

@@ -770,7 +769,7 @@ def deletePageRange(self, from_page=-1, to_page=-1):
770769
raise ValueError("operation illegal for closed doc")
771770

772771
val = _fitz.Document_deletePageRange(self, from_page, to_page)
773-
if val == 0: self._reset_page_refs()
772+
self._reset_page_refs()
774773

775774
return val
776775

@@ -781,7 +780,7 @@ def copyPage(self, pno, to=-1):
781780
raise ValueError("operation illegal for closed doc")
782781

783782
val = _fitz.Document_copyPage(self, pno, to)
784-
if val == 0: self._reset_page_refs()
783+
self._reset_page_refs()
785784

786785
return val
787786

@@ -817,7 +816,7 @@ def movePage(self, pno, to=-1):
817816
raise ValueError("operation illegal for closed doc")
818817

819818
val = _fitz.Document_movePage(self, pno, to)
820-
if val == 0: self._reset_page_refs()
819+
self._reset_page_refs()
821820

822821
return val
823822

@@ -828,9 +827,7 @@ def select(self, pyliste):
828827
raise ValueError("operation illegal for closed doc")
829828

830829
val = _fitz.Document_select(self, pyliste)
831-
if val == 0:
832-
self._reset_page_refs()
833-
self.initData()
830+
self._reset_page_refs()
834831

835832
return val
836833

@@ -861,19 +858,35 @@ def _getPageObjNumber(self, pno):
861858

862859

863860
def getPageImageList(self, pno):
864-
"""List images used on a page."""
861+
"""Show the images used on a page."""
865862
if self.isClosed:
866863
raise ValueError("operation illegal for closed doc")
867864

868-
return _fitz.Document_getPageImageList(self, pno)
865+
val = _fitz.Document_getPageImageList(self, pno)
866+
867+
x = []
868+
for v in val:
869+
if v not in x:
870+
x.append(v)
871+
val = x
872+
873+
return val
869874

870875

871876
def getPageFontList(self, pno):
872-
"""List the fonts used on a page."""
877+
"""Show the fonts used on a page."""
873878
if self.isClosed:
874879
raise ValueError("operation illegal for closed doc")
875880

876-
return _fitz.Document_getPageFontList(self, pno)
881+
val = _fitz.Document_getPageFontList(self, pno)
882+
883+
x = []
884+
for v in val:
885+
if v not in x:
886+
x.append(v)
887+
val = x
888+
889+
return val
877890

878891

879892
def extractFont(self, xref=0, info_only=0):
@@ -960,12 +973,12 @@ def _updateObject(self, xref, text, page=None):
960973
return _fitz.Document__updateObject(self, xref, text, page)
961974

962975

963-
def _updateStream(self, xref=0, stream=None):
964-
"""_updateStream(self, xref=0, stream=None) -> PyObject *"""
976+
def _updateStream(self, xref=0, stream=None, new=0):
977+
"""_updateStream(self, xref=0, stream=None, new=0) -> PyObject *"""
965978
if self.isClosed:
966979
raise ValueError("operation illegal for closed doc")
967980

968-
return _fitz.Document__updateStream(self, xref, stream)
981+
return _fitz.Document__updateStream(self, xref, stream, new)
969982

970983

971984
def _setMetadata(self, text):

0 commit comments

Comments
 (0)