Skip to content

How can I use FzPathWalker2 with FzDevice2? #3929

Discussion options

You must be logged in to vote

This is a tricky area, well done making things work!

There's some documentation about how to use MuPDF's Python bindings with callbacks, see: https://mupdf.readthedocs.io/en/latest/language-bindings.html#making-mupdf-function-pointers-call-python-code

There's also some code in pymupdf/__init__.py that uses a class derived from mupdf.FzPathWalker2, which will probably be helpful.

  • In particular, pymupdf/__init__.py:jm_lineart_path() does:

    mupdf.fz_walk_path( mupdf.FzPath(mupdf.ll_fz_keep_path(path)), walker, walker.m_internal)
    

    Which i think is close to what you've ended up with. The underlying reason why this works is that the C++ callbacks default to assuming that arg1 (arg0 is fz_conte…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Rodrigodd
Comment options

Answer selected by Rodrigodd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants