Difference: MupdfCppWrappers (18 vs. 19)

Revision 192020-08-18 - JulianSmith

Line: 1 to 1
META TOPICPARENT name="JulianSmith"

Auto-generated C++ and Python APIs for mupdf.

Line: 8 to 8


  • C++ API is generated by mupdf:scripts/mupdfwrap.py, which uses python-clang.
  • We require clang-6 or clang-7.
  • We generate C++ wrapper functions for most fz_ and pdf_ functions. These wrapper convert fz_ exceptions into C++ exceptions, and use auto-generated per-thread fz_context's.
  • We generate C++ class wrappers for most fz_ and pdf_ structs.
  • We auto-detect fz_*() and pdf_*() fns suitable for wrapping as constructors, methods or static methods.
  • Some generated classes have auto-generated support for iteration.
  • We add various custom methods/constructors.
  • Wrapper class constructors and methods provide access to 1270 fz_*() and pdf_*() fns, out of a total of 1513 wrapped fz_*() and pdf_*() functions. Most of the omitted functions don't take struct args, e.g. fz_strlcpy().
  • The C++ API is built by mupdf:scripts/mupdfwrap.py. It requires clang-6 or clang-7, and python-clang.


  • Python API is generated by running SWIG on the C++ API's header files.
  • Python API is enough to allow implementation of mutool in Python - see mupdf:scripts/mutool.py and mupdf:scripts/mutool_draw.py.
  • We work with swig-3 or swig-4.
  • Building the Python API requires swig-3 or swig-4.


  • We work on nuc1 and peeved and jules-laptop.
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 2014 Artifex Software Inc