Skip to content

Commit

Permalink
src/__init__.py: fix to work with latest mupdf.
Browse files Browse the repository at this point in the history
Use newly modified mupdf fns to call fz_document_handler fnptrs.
  • Loading branch information
julian-smith-artifex-com committed Jun 17, 2024
1 parent 7c77f7b commit d4e216c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2803,12 +2803,20 @@ def __init__(self, filename=None, stream=None, filetype=None, rect=None, width=0
stream = mupdf.FzStream(filename)
accel = mupdf.FzStream()
archive = mupdf.FzArchive(None)
doc = mupdf.ll_fz_document_open_fn_call(
handler.open,
stream.m_internal,
accel.m_internal,
archive.m_internal,
)
if mupdf_version_tuple >= (1, 25):
doc = mupdf.ll_fz_document_handler_open(
handler,
stream.m_internal,
accel.m_internal,
archive.m_internal,
)
else:
doc = mupdf.ll_fz_document_open_fn_call(
handler.open,
stream.m_internal,
accel.m_internal,
archive.m_internal,
)
else:
doc = mupdf.ll_fz_document_open_fn_call( handler.open, filename)
except Exception as e:
Expand Down

0 comments on commit d4e216c

Please sign in to comment.