Skip to content

Commit

Permalink
src/__init__.py: fix for calling pdf_rearrange_pages2() with mupdf >=…
Browse files Browse the repository at this point in the history
… 1.25.3.
  • Loading branch information
julian-smith-artifex-com committed Jan 22, 2025
1 parent 5d27b8d commit f42ef85
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5642,7 +5642,12 @@ def select(self, pyliste):
pdf = _as_pdf_document(self)
# create page sub-pdf via pdf_rearrange_pages2().
#
mupdf.pdf_rearrange_pages2(pdf, pyliste)
if mupdf_version_tuple >= (1, 25, 3):
# We use PDF_CLEAN_STRUCTURE_KEEP otherwise we lose structure tree
# which, for example, breaks test_3705.
mupdf.pdf_rearrange_pages2(pdf, pyliste, mupdf.PDF_CLEAN_STRUCTURE_KEEP)
else:
mupdf.pdf_rearrange_pages2(pdf, pyliste)

# remove any existing pages with their kids
self._reset_page_refs()
Expand Down

0 comments on commit f42ef85

Please sign in to comment.