MuPDF.js with npm: A Powerful PDF Solution for the Web
Jamie Lemon·June 24, 2023

A Brief History
MuPDF is a highly versatile, customizable, and lightweight PDF SDK that has been developed since 2002 by Artifex.
Part of MuPDF has, for some time, included a handy JavaScript interface designed to be used on the command-line for server side PDF processing. However, there hasn’t been a front-end JavaScript solution for MuPDF in the browser, until now …..
Welcome to MuPDF.js
When Artifex developed the WebAssembly (WASM) solution we inherited the underlying command-line JS API. We then built on top of it as required and named it MuPDF.js. We chose WASM to give end-users client side PDF rendering on the web.
So, simply put, MuPDF.js uses WASM and is MuPDF for your web applications.
Whether you're developing for a front-end PDF viewer, or a backend solution with node.js (or a mix of both!), the MuPDF package now available from npm will provide the solution you need.
What can you do with MuPDF.js?
MuPDF.js has an extensive API for achieving the typical things you might need to do with PDF, for example:
- Loading documents and finding pages.
- Searching pages for text and images.
- Extracting text.
- Manipulating PDF objects such as annotations and widgets.
- Editing PDFs.
- Saving documents.
Trying MuPDF.js
Simply go to https://www.npmjs.com/package/mupdf and check out the README to get started.

If you just want to dive straight in, then install via the command line with:
npm i mupdf
With npm new versions and the latest updates will always be available to you, and, if required, you can very easily select the version you want.
Exploring MuPDF.js Functionality
For a simple “getting started” which loads a local document follow the instructions here:
https://mupdf.readthedocs.io/en/latest/mupdf-wasm.html
There is also information on how to try a simple document viewer here:
https://mupdf.readthedocs.io/en/latest/mupdf-wasm.html#trying-the-viewer
Taking it Further
This blog post just scratches the surface of what can be achieved with MuPDF.js.
For a deep dive into the full API please see:
https://mupdf.readthedocs.io/en/latest/mupdf-js.html
We hope you enjoy the benefits and convenience of using npm as a solution for your MuPDF web applications! Let us know on our Discord channel if you have any questions or feature requests.