MuPDF / WebAssembly

The MuPDF WASM demo is a simple web application that uses MuPDF to render pages as images. You can scroll through the document, and it will render pages as they come into view. You can change the zoom level, follow links on the page and in the table of contents.

If you want to build a web application using MuPDF and write your own custom UI, then this is the place to start.

The viewer is split into two parts: an asynchronous library that spawns MuPDF in a Web Worker thread, and provides functions for loading PDF files, getting the table of contents, and rendering pages to PNG images ready to insert into the DOM.

The other part is a single page HTML application that exercises the asynchronous library. This application is written in simple Javascript with no dependencies.

WASM viewer demo.