Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,67 @@ Change Log
==========



**Changes in version**

Fixed issues:

* **Fixed** `4484 <https://github.com/pymupdf/PyMuPDF/issues/4484>`_: set_toc does not correctly set y-positions
* **Fixed** `5175 <https://github.com/pymupdf/PyMuPDF/issues/5175>`_: find_tables(lines_strict): opaque white fill+stroke rectangle creates a phantom row
* **Fixed** `5185 <https://github.com/pymupdf/PyMuPDF/issues/5185>`_: pymupdf4llm: table cells drop the second letter of a ligature when quad corrections are unset
* **Fixed** `5198 <https://github.com/pymupdf/PyMuPDF/issues/5198>`_: 2.0: Table.extract() moves the decimal point out of numbers ("0.74" comes back as "0 74", newline, ".") \u2014 regression from 1.28.2
* **Fixed** `5238 <https://github.com/pymupdf/PyMuPDF/issues/5238>`_: JM_new_lineart_device_Device.__init__ omits call parentheses on use_virtual_*_text, disabling SWIG director text callbacks
* **Fixed** `5239 <https://github.com/pymupdf/PyMuPDF/issues/5239>`_: Document.set_toc_item() crashes on point-like tuple/list coordinates (AttributeError) and inverts dest_dict['to'] via in-place mutation
* **Fixed** `5240 <https://github.com/pymupdf/PyMuPDF/issues/5240>`_: Document.delete_pages() raises ValueError: bad page number(s) on negative page numbers passed as two positional arguments
* **Fixed** `5241 <https://github.com/pymupdf/PyMuPDF/issues/5241>`_: Table.to_pandas() permanently mutates Table.header.names in-place, corrupting column names and downstream exports #5241
* **Fixed** `5280 <https://github.com/pymupdf/PyMuPDF/issues/5280>`_: remove_rotation() stretches Square and Circle annotations #5280


New features

* Add extended FormFields Support.


Other:

* Various small correctness fixes.

- Archive.add(): fix broken assert (missing comma turned the error
message into part of the boolean expression, disabling the empty-name
check for binary content).
- Annot.file_info: avoid UnboundLocalError when a crafted/malformed
attachment's /FS dict has neither /UF nor /F.
- Page.set_language(): call pdfpage.obj() instead of passing the bound
method itself, which broke every call that actually sets a language.
- Widget.on_state(): skip None entries from button_states() instead of
raising TypeError.
- Pixmap.tobytes(): add missing f-string prefix so the alpha error
message actually includes the format name.
- JM_matrix_from_py(): fix copy-paste bug returning FzRect() instead of
FzMatrix() on the float-conversion failure path.
- utils.get_text(): remove a bare assert that made the documented
"misspelled option falls back to text" behavior unreachable.
- utils.get_label_pno(): return "" (as documented) instead of raising
IndexError when no label rule applies to the given page number.
- utils.get_sorted_text(): guard against ZeroDivisionError for
zero-width glyph bboxes.
- _apply_pages.py (method='fork'): send the actual page numbers to
workers instead of plain list indices, which silently processed the
wrong pages for any non-contiguous/non-zero-based `pages` list.
- table.chars_in_rect(): compare against c["top"]/c["bottom"] (top-down,
matching the rect from page.get_drawings()) instead of c["y0"]/c["y1"]
(PDF-native bottom-up space), fixing table detection for frames drawn
as filled rectangles.
* get_text: fail on unrecognized option instead of silently defaulting
* apply_pages(): Fix keyword forwarding in single-process page extraction,
* Fixed sysinstall of mupdf.
* Fix Document.convert_to_pdf() for page ranges that do not start at page 0
* Some fixes for windows-x32.
* Preserve line breaks and hyphens in clean table Markdown
* Fix table header boldness checks to use page coordinates
* Continue letter page labels with AA, BB, ... after Z, as the PDF spec says


**Changes in version 2.1** (2026-11-02)

Fixed issues:
Expand Down
Binary file added tests/resources/test_4484.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2004,3 +2004,18 @@ def test_5241():
names_after = list(tab.header.names)
assert names_before == names_after, "Column headers changed by to_pandas()"



def test_5198():
doc = pymupdf.open()
page = doc.new_page(width=595, height=842)
x0, y0, x1, y1, xm, ym = 72, 72, 472, 152, 272, 112
for a, b in [((x0, y0), (x1, y0)), ((x0, ym), (x1, ym)), ((x0, y1), (x1, y1)),
((x0, y0), (x0, y1)), ((xm, y0), (xm, y1)), ((x1, y0), (x1, y1))]:
page.draw_line(a, b)
for text, point in [("P for interaction", (80, 100)), ("Cooking fuel type", (280, 100)),
("0.74", (80, 140)), ("12.5 mg", (280, 140))]:
page.insert_text(point, text, fontsize=11)

print(pymupdf.__version__, [t.extract() for t in page.find_tables().tables])
print([w[4] for w in page.get_text("words")])
11 changes: 11 additions & 0 deletions tests/test_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,14 @@ def test_5239():
link_dict = toc[0][-1]
assert link_dict["to"] == p


def test_4484():
path = os.path.normpath(f'{__file__}/../../tests/resources/test_4484.pdf')
doc = pymupdf.open(path)
toc = [[1, 'Engine Fire In Flight', 0, 304.6222839355469]]
doc.set_toc(toc)
read_toc = doc.get_toc(simple=False)
desired_y_position = toc[0][3]
actual_y_position = read_toc[0][3]["to"][1]
dy = abs(actual_y_position - desired_y_position)
assert dy < 0.01, f'dy too large: {desired_y_position=} {actual_y_position=} {dy=}'
Loading