Overview

MuPDF is written as an extensible framework for handling different document types. Each different document format provides a fz_document_handler structure that provides the required callbacks to recognise and open files of its supported type. For example:


\begin{lstlisting}
extern fz_document_handler pdf_document_handler;
extern fz_do...
...t_handler;
extern fz_document_handler svg_document_handler;
...
\end{lstlisting}

At startup, the calling program must register the required document handlers. It can either register them each individually, by repeatedly calling fz_register_document_handler:


\begin{lstlisting}
/*
fz_register_document_handler: Register a handler
for a d...
...t_handler(fz_context *ctx, const fz_document_handler *handler);
\end{lstlisting}

For example:


\begin{lstlisting}
fz_register_document_handler(ctx, &pdf_document_handler);
f...
... fz_register_document_handler(ctx, &svg_document_handler);
...
\end{lstlisting}

or, it can use a convenience function to register all the standard handlers enabled in a given build:


\begin{lstlisting}
/*
fz_register_document_handler: Register handlers
for all ...
... build.
*/
void fz_register_document_handlers(fz_context *ctx);
\end{lstlisting}