20.1 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:
extern fz_document_handler pdf_document_handler; extern fz_document_handler xps_document_handler; extern fz_document_handler svg_document_handler; ...
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:
/* fz_register_document_handler: Register a handler for a document type. handler: The handler to register. */ void fz_register_document_handler(fz_context *ctx, const fz_document_handler *handler);
For example:
fz_register_document_handler(ctx, &pdf_document_handler); fz_register_document_handler(ctx, &xps_document_handler); fz_register_document_handler(ctx, &svg_document_handler); ...
or, it can use a convenience function to register all the standard handlers enabled in a
given build:
/* fz_register_document_handler: Register handlers for all the standard document types supported in this build. */ void fz_register_document_handlers(fz_context *ctx);