Skip to content

Commit 2a2a24a

Browse files
committed
Merge remote-tracking branch 'origin/main' into support-miter
2 parents 087fbc6 + ad4b871 commit 2a2a24a

File tree

10 files changed

+78
-60
lines changed

10 files changed

+78
-60
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,10 @@ body:
4747
label: PyMuPDF version
4848
options:
4949
-
50+
- 1.25.2
5051
- 1.25.1
5152
- 1.25.0
52-
- 1.24.14
53-
- 1.24.13
54-
- 1.24.12
55-
- 1.24.11
56-
- 1.24.10
57-
- 1.24.9
58-
- 1.24.8
59-
- 1.24.7
60-
- 1.24.6
61-
- 1.24.5
62-
- 1.24.4
63-
- 1.24.3
64-
- 1.24.2
65-
- 1.24.1
66-
- 1.24.0
67-
- 1.23.x or earlier
53+
- 1.24.x or earlier
6854
- Built from source
6955
description: |
7056
* For example from `pymupdf.VersionBind`.

changes.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ Change Log
22
==========
33

44

5+
**Changes in version 1.25.2 (2025-01-17)**
6+
7+
* Fixed issues:
8+
9+
* **Fixed** `4055 <https://github.com/pymupdf/PyMuPDF/issues/4055>`_: "Yes" for all checkboxes does not work for all PDF rendering engines.
10+
* **Fixed** `4155 <https://github.com/pymupdf/PyMuPDF/issues/4155>`_: samples_mv is unsafe
11+
* **Fixed** `4186 <https://github.com/pymupdf/PyMuPDF/issues/4186>`_: Incorrect handling of JPEG with color space CMYK image extraction
12+
* **Fixed** `4225 <https://github.com/pymupdf/PyMuPDF/issues/4225>`_: pixmap.pil_save() fails due to colorspace definition
13+
* **Fixed** `4232 <https://github.com/pymupdf/PyMuPDF/issues/4232>`_: Incorrect Font style and Size
14+
15+
* Other:
16+
17+
* Use Python's built-in glyphname <> unicode conversion.
18+
* Improve speed of pixmap color inversion.
19+
* Add new `char_flags` member to span dictionary, for example allows detection of invisible text.
20+
* Detect image masks in TextPage output.
21+
* Added `Pixmap.pil_image()`.
22+
23+
524
**Changes in version 1.25.1 (2024-12-11)**
625

726
* Use MuPDF-1.25.2.

docs/installation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ Using with Pyodide
269269
See :doc:`pyodide`.
270270

271271

272+
.. _installation_ocr:
273+
272274
Enabling Integrated OCR Support
273275
---------------------------------------------------------
274276

docs/recipes-ocr.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ OCR - Optical Character Recognition
1818

1919
|PyMuPDF| has integrated support for OCR (Optical Character Recognition). It is possible to use OCR for both, images (via the :ref:`Pixmap` class) and for document pages.
2020

21-
The feature is currently based on Tesseract-OCR which must be installed as a separate application -- see the installation chapter.
21+
The feature is currently based on Tesseract-OCR which must be installed as a separate application -- see the :ref:`installation_ocr`.
2222

2323
How to OCR an Image
2424
--------------------

docs/version.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
----
22

3-
This documentation covers **PyMuPDF v1.25.1** features as of **2024-12-11 00:00:01**.
3+
This documentation covers **PyMuPDF v1.25.2** features as of **2025-01-17 00:00:01**.
44

55
The major and minor versions of **PyMuPDF** and **MuPDF** will always be the same. Only the third qualifier (patch level) may deviate from that of **MuPDF**.
66

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ def sdist():
11571157
# We generate different wheels depending on PYMUPDF_SETUP_FLAVOUR.
11581158
#
11591159

1160-
version_p = '1.25.1'
1160+
version_p = '1.25.2'
11611161
version_b = '1.25.1'
11621162
version_mupdf = '1.25.2'
11631163

src/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ def _int_rc(text):
373373

374374
# Basic version information.
375375
#
376-
pymupdf_version = "1.25.1"
376+
pymupdf_version = "1.25.2"
377377
mupdf_version = mupdf.FZ_VERSION
378-
pymupdf_date = "2024-12-11 00:00:01"
378+
pymupdf_date = "2025-01-17 00:00:01"
379379

380380
# Versions as tuples; useful when comparing versions.
381381
#

tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def get_fds():
4242
pymupdf._log_items_clear()
4343
pymupdf._log_items_active(True)
4444

45+
JM_annot_id_stem = pymupdf.JM_annot_id_stem
46+
4547
# Run the test.
4648
rep = yield
4749

@@ -57,6 +59,9 @@ def get_fds():
5759
log_items = pymupdf._log_items()
5860
assert not log_items, f'log() was called; {len(log_items)=}.'
5961

62+
assert pymupdf.JM_annot_id_stem == JM_annot_id_stem, \
63+
f'pymupdf.JM_annot_id_stem has changed from {JM_annot_id_stem!r} to {pymupdf.JM_annot_id_stem!r}'
64+
6065
if platform.system() == 'Linux':
6166
# Show detailed information about leaked fds.
6267
open_fds_after, open_fds_after_l = get_fds()

tests/test_annots.py

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import gentle_compare
1111

1212

13-
pymupdf.TOOLS.set_annot_stem("jorj")
14-
1513
red = (1, 0, 0)
1614
blue = (0, 0, 1)
1715
gold = (1, 1, 0)
@@ -226,38 +224,46 @@ def test_1645():
226224
'''
227225
Test fix for #1645.
228226
'''
229-
path_in = os.path.abspath( f'{__file__}/../resources/symbol-list.pdf')
230-
231-
if pymupdf.mupdf_version_tuple >= (1, 26):
232-
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.26.pdf')
233-
elif pymupdf.mupdf_version_tuple >= (1, 25):
234-
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.25.pdf')
235-
elif pymupdf.mupdf_version_tuple >= (1, 24, 2):
236-
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.24.2.pdf')
237-
else:
238-
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.24.pdf')
239-
path_out = os.path.abspath( f'{__file__}/../test_1645_out.pdf')
240-
doc = pymupdf.open(path_in)
241-
page = doc[0]
242-
page_bounds = page.bound()
243-
annot_loc = pymupdf.Rect(page_bounds.x0, page_bounds.y0, page_bounds.x0 + 75, page_bounds.y0 + 15)
244-
# Check type of page.derotation_matrix - this is #2911.
245-
assert isinstance(page.derotation_matrix, pymupdf.Matrix), \
246-
f'Bad type for page.derotation_matrix: {type(page.derotation_matrix)=} {page.derotation_matrix=}.'
247-
page.add_freetext_annot(
248-
annot_loc * page.derotation_matrix,
249-
"TEST",
250-
fontsize=18,
251-
fill_color=pymupdf.utils.getColor("FIREBRICK1"),
252-
rotate=page.rotation,
253-
)
254-
doc.save(path_out, garbage=1, deflate=True, no_new_id=True)
255-
print(f'Have created {path_out}. comparing with {path_expected}.')
256-
with open( path_out, 'rb') as f:
257-
out = f.read()
258-
with open( path_expected, 'rb') as f:
259-
expected = f.read()
260-
assert out == expected, f'Files differ: {path_out} {path_expected}'
227+
# The expected output files assume annot_stem is 'jorj'. We need to always
228+
# restore this before returning (this is checked by conftest.py).
229+
annot_stem = pymupdf.JM_annot_id_stem
230+
pymupdf.TOOLS.set_annot_stem('jorj')
231+
try:
232+
path_in = os.path.abspath( f'{__file__}/../resources/symbol-list.pdf')
233+
234+
if pymupdf.mupdf_version_tuple >= (1, 26):
235+
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.26.pdf')
236+
elif pymupdf.mupdf_version_tuple >= (1, 25):
237+
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.25.pdf')
238+
elif pymupdf.mupdf_version_tuple >= (1, 24, 2):
239+
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.24.2.pdf')
240+
else:
241+
path_expected = os.path.abspath( f'{__file__}/../../tests/resources/test_1645_expected_1.24.pdf')
242+
path_out = os.path.abspath( f'{__file__}/../test_1645_out.pdf')
243+
doc = pymupdf.open(path_in)
244+
page = doc[0]
245+
page_bounds = page.bound()
246+
annot_loc = pymupdf.Rect(page_bounds.x0, page_bounds.y0, page_bounds.x0 + 75, page_bounds.y0 + 15)
247+
# Check type of page.derotation_matrix - this is #2911.
248+
assert isinstance(page.derotation_matrix, pymupdf.Matrix), \
249+
f'Bad type for page.derotation_matrix: {type(page.derotation_matrix)=} {page.derotation_matrix=}.'
250+
page.add_freetext_annot(
251+
annot_loc * page.derotation_matrix,
252+
"TEST",
253+
fontsize=18,
254+
fill_color=pymupdf.utils.getColor("FIREBRICK1"),
255+
rotate=page.rotation,
256+
)
257+
doc.save(path_out, garbage=1, deflate=True, no_new_id=True)
258+
print(f'Have created {path_out}. comparing with {path_expected}.')
259+
with open( path_out, 'rb') as f:
260+
out = f.read()
261+
with open( path_expected, 'rb') as f:
262+
expected = f.read()
263+
assert out == expected, f'Files differ: {path_out} {path_expected}'
264+
finally:
265+
# Restore annot_stem.
266+
pymupdf.TOOLS.set_annot_stem(annot_stem)
261267

262268
def test_1824():
263269
'''

tests/test_toc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ def test_3347():
187187
})
188188

189189
links_expected = [
190-
(0, {'kind': 1, 'xref': 11, 'from': pymupdf.Rect(10.0, 20.0, 50.0, 40.0), 'page': 0, 'to': pymupdf.Point(300.0, 350.0), 'zoom': 0.0, 'id': 'jorj-L0'}),
191-
(0, {'kind': 1, 'xref': 12, 'from': pymupdf.Rect(300.0, 350.0, 400.0, 450.0), 'page': 1, 'to': pymupdf.Point(20.0, 30.0), 'zoom': 0.0, 'id': 'jorj-L1'}),
192-
(1, {'kind': 1, 'xref': 13, 'from': pymupdf.Rect(20.0, 30.0, 40.0, 50.0), 'page': 1, 'to': pymupdf.Point(350.0, 300.0), 'zoom': 0.0, 'id': 'jorj-L0'}),
193-
(1, {'kind': 1, 'xref': 14, 'from': pymupdf.Rect(350.0, 300.0, 450.0, 400.0), 'page': 0, 'to': pymupdf.Point(10.0, 20.0), 'zoom': 0.0, 'id': 'jorj-L1'}),
190+
(0, {'kind': 1, 'xref': 11, 'from': pymupdf.Rect(10.0, 20.0, 50.0, 40.0), 'page': 0, 'to': pymupdf.Point(300.0, 350.0), 'zoom': 0.0, 'id': 'fitz-L0'}),
191+
(0, {'kind': 1, 'xref': 12, 'from': pymupdf.Rect(300.0, 350.0, 400.0, 450.0), 'page': 1, 'to': pymupdf.Point(20.0, 30.0), 'zoom': 0.0, 'id': 'fitz-L1'}),
192+
(1, {'kind': 1, 'xref': 13, 'from': pymupdf.Rect(20.0, 30.0, 40.0, 50.0), 'page': 1, 'to': pymupdf.Point(350.0, 300.0), 'zoom': 0.0, 'id': 'fitz-L0'}),
193+
(1, {'kind': 1, 'xref': 14, 'from': pymupdf.Rect(350.0, 300.0, 450.0, 400.0), 'page': 0, 'to': pymupdf.Point(10.0, 20.0), 'zoom': 0.0, 'id': 'fitz-L1'}),
194194
]
195195

196196
path = os.path.normpath(f'{__file__}/../../tests/test_3347_out.pdf')
@@ -264,7 +264,7 @@ def test_3400():
264264
print(f'Saved to {path=}.')
265265

266266
links_expected = [
267-
(1, {'kind': 1, 'xref': 1120, 'from': pymupdf.Rect(10.0, 10.0, 100.0, 50.0), 'page': 0, 'to': pymupdf.Point(187.5, 472.5), 'zoom': 0.0, 'id': 'jorj-L0'})
267+
(1, {'kind': 1, 'xref': 1120, 'from': pymupdf.Rect(10.0, 10.0, 100.0, 50.0), 'page': 0, 'to': pymupdf.Point(187.5, 472.5), 'zoom': 0.0, 'id': 'fitz-L0'})
268268
]
269269

270270
links_actual = list()

0 commit comments

Comments
 (0)