Skip to content

Commit

Permalink
upload v1.19.5
Browse files Browse the repository at this point in the history
  • Loading branch information
JorjMcKie committed Feb 3, 2022
1 parent c033e10 commit 389e947
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 84 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PyMuPDF 1.19.4
# PyMuPDF 1.19.5

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

Release date: January 01, 2022
Release date: February 01, 2022

On **[PyPI](https://pypi.org/project/PyMuPDF)** since August 2016: [![Downloads](https://static.pepy.tech/personalized-badge/pymupdf?period=total&units=international_system&left_color=black&right_color=orange&left_text=Downloads)](https://pepy.tech/project/pymupdf)

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

# Introduction

PyMuPDF (current version 1.19.4) is a Python binding with support for [MuPDF](https://mupdf.com/) (current version 1.19.*), a lightweight PDF, XPS, and E-book viewer, renderer, and toolkit, which is maintained and developed by Artifex Software, Inc.
PyMuPDF (current version 1.19.5) is a Python binding with support for [MuPDF](https://mupdf.com/) (current version 1.19.*), a lightweight PDF, XPS, and E-book viewer, renderer, and toolkit, which is maintained and developed by Artifex Software, Inc.

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.

Expand Down Expand Up @@ -70,7 +70,7 @@ The latest changelog can be viewed [here](https://pymupdf.readthedocs.io/en/late

PyMuPDF **requires Python 3.6 or later**.

Python wheels exist for **Windows** (32bit and 64bit), **Linux** (64bit, Intel and ARM) and **Mac OSX** (64bit, Intel only), so it can be installed from [PyPI](https://pypi.org/search/?q=pymupdf) in the usual way:
For versions 3.7 and up, Python wheels exist for **Windows** (32bit and 64bit), **Linux** (64bit, Intel and ARM) and **Mac OSX** (64bit, Intel only), so it can be installed from [PyPI](https://pypi.org/search/?q=pymupdf) in the usual way:

```
python -m pip install --upgrade pip
Expand All @@ -87,11 +87,9 @@ There are **no mandatory** external dependencies. However, some **optional featu

Older wheels - also with support for older Python versions - can be found [here](https://github.com/pymupdf/PyMuPDF-Optional-Material/tree/master/wheels-upto-Py3.5>) and on PyPI.

> Starting with v1.18.15, to minimize network traffic we no longer redundantly store wheels in this repository's `releases` folder. You can find older versions back to v1.9.2 on [PyPI](https://pypi.org/project/PyMuPDF/#history). Sources for every release continue to be stored in [here](https://github.com/pymupdf/PyMuPDF/releases).
Other platforms **require installation from sources**, follow [these](https://pymupdf.readthedocs.io/en/latest/installation.html) instructions in the documentation.

> **Note:** If `pip` cannot find a wheel that is compatible with your platform, it will automatically start an installation from sources - **_which will fail_** if MuPDF is not installed on your system.
> **Note:** If `pip` cannot find a wheel that is compatible with your platform, it will automatically try an installation from sources - **_which will fail_** if MuPDF (including its sources) is not installed on your system.
This repo's folder [installation](https://github.com/pymupdf/PyMuPDF/tree/master/installation) contains several platform-specific source installation scripts contributed by users. You may also find the following Wiki pages useful:

Expand Down
25 changes: 25 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
Change Log
===========

------

**Changes in Version 1.19.5**

* **Fixed** `#1518 <https://github.com/pymupdf/PyMuPDF/issues/1518>`_. A limited "fix": in some cases, rectangles and quadrupels were not correctly encoded to support re-drawing by :ref:`Shape`.

* **Fixed** `#1521 <https://github.com/pymupdf/PyMuPDF/issues/1521>`_. This had the same ultimate reason behind issue #1510.

* **Fixed** `#1513 <https://github.com/pymupdf/PyMuPDF/issues/1513>`_. Some Optional Content functions did not support non-ASCII characters.

* **Fixed** `#1510 <https://github.com/pymupdf/PyMuPDF/issues/1510>`_. Support more soft-mask image subtypes.

* **Fixed** `#1507 <https://github.com/pymupdf/PyMuPDF/issues/1507>`_. Immunize against items in the outlines chain, that are ``"null"`` objects.

* **Fixed** re-opened `#1417 <https://github.com/pymupdf/PyMuPDF/issues/1417>`_. ("too many open files"). This was due to insufficient calls to MuPDF's ``fz_drop_document()``. This also fixes `#1550 <https://github.com/pymupdf/PyMuPDF/issues/1550>`_.

* **Fixed** several undocumented issues in relation to incorrectly setting the text span origin :data:`point_like`.

* **Fixed** undocumented error computing the character bbox in method :meth:`Page.get_texttrace` when text is **flipped** (as opposed to just rotated).

* **Added** items to the dictionary returned by :meth:`image_properties`: ``orientation`` and ``transform`` report the natural image orientation (EXIF data).

* **Added** method :meth:`Document.xref_copy`. It will make a given target PDF object an exact copy of a source object.


------

**Changes in Version 1.19.4**
Expand Down
6 changes: 4 additions & 2 deletions fitz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
fitz.Document.subset_fonts = fitz.utils.subset_fonts
fitz.Document.get_oc = fitz.utils.get_oc
fitz.Document.set_oc = fitz.utils.set_oc
fitz.Document.xref_copy = fitz.utils.xref_copy


# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -429,7 +430,7 @@ def deprecated_function(*args, **kw):
_alias(fitz, "PaperSize", "paper_size")
_alias(fitz, "PaperRect", "paper_rect")
_alias(fitz, "paperSizes", "paper_sizes")
_alias(fitz, "ImageProperties", "image_properties")
_alias(fitz, "ImageProperties", "image_profile")
_alias(fitz, "planishLine", "planish_line")
_alias(fitz, "getTextLength", "get_text_length")
_alias(fitz, "getTextlength", "get_text_length")
Expand All @@ -449,4 +450,5 @@ def deprecated_function(*args, **kw):
64 if sys.maxsize > 2 ** 32 else 32,
)

restore_aliases()
if VersionBind.startswith("1.19"): # don't generate aliases after this
restore_aliases()
98 changes: 70 additions & 28 deletions fitz/fitz.i
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ struct Document
{
DEBUGMSG1("Document");
fz_document *this_doc = (fz_document *) $self;
while (this_doc->refs > 1) {
fz_drop_document(gctx, this_doc);
}
fz_drop_document(gctx, this_doc);
DEBUGMSG2;
}
Expand Down Expand Up @@ -764,8 +767,11 @@ struct Document
if (!first) goto finished;
xrefs = PyList_New(0); // pre-allocate an empty list
xrefs = JM_outline_xrefs(gctx, first, xrefs);
Py_ssize_t i, n = PySequence_Size(xrefs);
Py_ssize_t i, n = PySequence_Size(xrefs), m = PySequence_Size(items);
if (!n) goto finished;
if (n != m) {
THROWMSG(gctx, "internal error finding outline xrefs");
}
int xref;
// update all TOC item dictionaries
Expand Down Expand Up @@ -3832,9 +3838,9 @@ if basestate:
case (2): type = "radiobox"; break;
default: type = "label"; break;
}
PyObject *item = Py_BuildValue("{s:i,s:s,s:i,s:s,s:O,s:O}",
PyObject *item = Py_BuildValue("{s:i,s:N,s:i,s:s,s:N,s:N}",
"number", i,
"text", info.text,
"text", JM_EscapeStrFromStr(info.text),
"depth", info.depth,
"type", type,
"on", JM_BOOL(info.selected),
Expand Down Expand Up @@ -6221,7 +6227,7 @@ def get_oc_items(self) -> list:
if rect == None:
return self.cropbox
mb = self.mediabox
return Rect(rect[0], mb.y1 - rect[1], rect[2], mb.y1 - rect[3])
return Rect(rect[0], mb.y1 - rect[3], rect[2], mb.y1 - rect[1])
@property
def trimbox(self):
Expand All @@ -6230,7 +6236,7 @@ def get_oc_items(self) -> list:
if rect == None:
return self.cropbox
mb = self.mediabox
return Rect(rect[0], mb.y1 - rect[1], rect[2], mb.y1 - rect[3])
return Rect(rect[0], mb.y1 - rect[3], rect[2], mb.y1 - rect[1])
@property
def bleedbox(self):
Expand All @@ -6239,7 +6245,7 @@ def get_oc_items(self) -> list:
if rect == None:
return self.cropbox
mb = self.mediabox
return Rect(rect[0], mb.y1 - rect[1], rect[2], mb.y1 - rect[3])
return Rect(rect[0], mb.y1 - rect[3], rect[2], mb.y1 - rect[1])
def _set_pagebox(self, boxtype, rect):
doc = self.parent
Expand Down Expand Up @@ -6713,7 +6719,18 @@ def insert_font(self, fontname="helv", fontfile=None, fontbuffer=None,
del pymupdf_fonts
# install the font for the page
val = self._insertFont(fontname, bfname, fontfile, fontbuffer, set_simple, idx,
if fontfile != None:
if type(fontfile) is str:
fontfile_str = fontfile
elif hasattr(fontfile, "absolute"):
fontfile_str = str(fontfile)
elif hasattr(fontfile, "name"):
fontfile_str = fontfile.name
else:
raise ValueError("bad fontfile")
else:
fontfile_str = None
val = self._insertFont(fontname, bfname, fontfile_str, fontbuffer, set_simple, idx,
wmode, serif, encoding, CJK_number)
if not val: # did not work, error return
Expand Down Expand Up @@ -7111,6 +7128,9 @@ Pixmap(PDFdoc, xref) - from an image xref in a PDF document.
fz_pixmap *src_pix = (fz_pixmap *) spix;
fz_try(gctx) {
fz_irect bbox = JM_irect_from_py(clip);
if (clip != Py_None && (fz_is_infinite_irect(bbox) || fz_is_empty_irect(bbox))) {
THROWMSG(gctx, "bad clip parameter");
}
if (!fz_is_infinite_irect(bbox)) {
pm = fz_scale_pixmap(gctx, src_pix, src_pix->x, src_pix->y, w, h, &bbox);
} else {
Expand Down Expand Up @@ -7266,7 +7286,9 @@ Pixmap(PDFdoc, xref) - from an image xref in a PDF document.
THROWMSG(gctx, "bad xref");
ref = pdf_new_indirect(gctx, pdf, xref, 0);
type = pdf_dict_get(gctx, ref, PDF_NAME(Subtype));
if (!pdf_name_eq(gctx, type, PDF_NAME(Image)))
if (!pdf_name_eq(gctx, type, PDF_NAME(Image)) &&
!pdf_name_eq(gctx, type, PDF_NAME(Alpha)) &&
!pdf_name_eq(gctx, type, PDF_NAME(Luminosity)))
THROWMSG(gctx, "not an image");
img = pdf_load_image(gctx, pdf, ref);
pix = fz_get_pixmap_from_image(gctx, img, NULL, NULL, NULL, NULL);
Expand Down Expand Up @@ -8159,12 +8181,14 @@ Includes alpha byte if applicable.""")
return self
def __exit__(self, *args):
self.__swig_destroy__(self)
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
def __del__(self):
if not type(self) is Pixmap:
return
self.__swig_destroy__(self)
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
Expand Down Expand Up @@ -8440,7 +8464,8 @@ struct Annot
~Annot()
{
DEBUGMSG1("Annot");
pdf_drop_annot(gctx, (pdf_annot *) $self);
pdf_annot *this_annot = (pdf_annot *) $self;
pdf_drop_annot(gctx, this_annot);
DEBUGMSG2;
}
//----------------------------------------------------------------
Expand Down Expand Up @@ -10313,7 +10338,8 @@ struct Link
%extend {
~Link() {
DEBUGMSG1("Link");
fz_drop_link(gctx, (fz_link *) $self);
fz_link *this_link = (fz_link *) $self;
fz_drop_link(gctx, this_link);
DEBUGMSG2;
}
Expand Down Expand Up @@ -10530,7 +10556,8 @@ struct DisplayList {
{
~DisplayList() {
DEBUGMSG1("DisplayList");
fz_drop_display_list(gctx, (fz_display_list *) $self);
fz_display_list *this_dl = (fz_display_list *) $self;
fz_drop_display_list(gctx, this_dl);
DEBUGMSG2;
}
FITZEXCEPTION(DisplayList, !result)
Expand Down Expand Up @@ -10618,7 +10645,8 @@ struct DisplayList {
def __del__(self):
if not type(self) is DisplayList:
return
self.__swig_destroy__(self)
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Expand All @@ -10631,7 +10659,8 @@ struct TextPage {
~TextPage()
{
DEBUGMSG1("TextPage");
fz_drop_stext_page(gctx, (fz_stext_page *) $self);
fz_stext_page *this_tp = (fz_stext_page *) $self;
fz_drop_stext_page(gctx, this_tp);
DEBUGMSG2;
}
Expand Down Expand Up @@ -11146,8 +11175,10 @@ struct TextPage {
return val
def __del__(self):
if not type(self) is TextPage: return
self.__swig_destroy__(self)
if not type(self) is TextPage:
return
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Expand All @@ -11162,7 +11193,8 @@ struct Graftmap
~Graftmap()
{
DEBUGMSG1("Graftmap");
pdf_drop_graft_map(gctx, (pdf_graft_map *) $self);
pdf_graft_map *this_gm = (pdf_graft_map *) $self;
pdf_drop_graft_map(gctx, this_gm);
DEBUGMSG2;
}
Expand All @@ -11183,8 +11215,10 @@ struct Graftmap
%pythoncode %{
def __del__(self):
if not type(self) is Graftmap: return
self.__swig_destroy__(self)
if not type(self) is Graftmap:
return
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Expand All @@ -11199,7 +11233,8 @@ struct TextWriter
~TextWriter()
{
DEBUGMSG1("TextWriter");
fz_drop_text(gctx, (fz_text *) $self);
fz_text *this_tw = (fz_text *) $self;
fz_drop_text(gctx, this_tw);
DEBUGMSG2;
}
Expand Down Expand Up @@ -11488,8 +11523,10 @@ struct TextWriter
}
%pythoncode %{
def __del__(self):
if not type(self) is TextWriter: return
self.__swig_destroy__(self)
if not type(self) is TextWriter:
return
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Expand All @@ -11505,7 +11542,8 @@ struct Font
~Font()
{
DEBUGMSG1("Font");
fz_drop_font(gctx, (fz_font *) $self);
fz_font *this_font = (fz_font *) $self;
fz_drop_font(gctx, this_font);
DEBUGMSG2;
}
Expand Down Expand Up @@ -11833,8 +11871,10 @@ struct Font
return "Font('%s')" % self.name
def __del__(self):
if not type(self) is Font: return
self.__swig_destroy__(self)
if not type(self) is Font:
return
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Expand Down Expand Up @@ -12846,8 +12886,10 @@ def _le_rclosedarrow(self, annot, p1, p2, lr, fill_color):
return ap
def __del__(self):
if not type(self) is Tools: return
self.__swig_destroy__(self)
if not type(self) is Tools:
return
if getattr(self, "thisown", False):
self.__swig_destroy__(self)
%}
}
};
Loading

0 comments on commit 389e947

Please sign in to comment.