Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Welcome to official MuPDF.js library from Artifex - the maintainers of MuPDF.
This is a build of MuPDF for JavaScript and TypeScript, using the speed and performance of WebAssembly.
The MuPDF.js library can be used both in browsers and in Node.js.
From the command line, go to the folder you want to work from and run:
npm install mupdf
The mupdf module is only available as an ESM module.
Either use the .mjs
file extension or change the project type:
npm pkg set type=module
The following example script demonstrates how to load a document and then print out the page count.
Create a file count-pages.mjs
:
import * as process from "node:process"
import * as fs from "node:fs"
import * as mupdf from "mupdf"
if (process.argv.length < 3) {
console.error("usage: node count-pages.mjs file.pdf");
process.exit(1);
}
const filename = process.argv[2];
const doc = mupdf.Document.openDocument(fs.readFileSync(filename), "application/pdf");
const count = doc.countPages();
console.log(`${filename} has ${count} pages.`);
Run the script:
node count-pages.mjs file.pdf
To use TypeScript you need to create a tsconfig.json
project file to tell the
compiler and Visual Studio Code to use the "nodenext" module resolution:
{
"compilerOptions": {
"module": "nodenext"
}
}
MuPDF.js is available under Open Source AGPL and commercial license agreements. If you determine you cannot meet the requirements of the AGPL, please contact Artifex for more information regarding a commercial license.
For documentation please refer to mupdfjs.readthedocs.io.
Check out the example projects to help you get started. The examples include a simple PDF Viewer that runs mupdf in the browser, several command line scripts, and more!
You can build the MuPDF.js library from source by referring to BUILDING.md.
To contribute please open up (or help answer!) an Issue on our Github board and create a Pull Request (PR) for review. Find us on Discord at #mupdf-js to chat with us directly.
FAQs
MuPDF.js
We found that mupdf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.