Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "mupdf", | ||
"version": "0.1.1", | ||
"description": "MuPDF WASM Library", | ||
"version": "0.1.2", | ||
"description": "MuPDF.js", | ||
"exports": "./lib/mupdf.js", | ||
@@ -13,3 +13,3 @@ "files": [ | ||
"type": "git", | ||
"url": "https://git.ghostscript.com/mupdf.git" | ||
"url": "https://github.com/ArtifexSoftware/mupdf-js.git" | ||
}, | ||
@@ -16,0 +16,0 @@ "keywords": [ |
# MuPDF.js | ||
This is a build of MuPDF targeting WASM environments. | ||
This is a build of [MuPDF](https://mupdf.com) for **JavaScript** & [WebAssembly](https://webassembly.org) environments. | ||
The MuPDF.js library can be used both in browsers and in Node. | ||
The **MuPDF.js** library (`lib/mupdf.js`) can be used both in browsers and in [Node.js](https://nodejs.org). | ||
This library is very similar in design and use to the MuPDF Java library. | ||
The same classes and methods can be used in the same way -- but there are also a few | ||
conveniences available here thanks to the dynamic nature of Javascript that are | ||
not available in the Java API. | ||
## Features | ||
- Fast rendering of **PDF** files | ||
- Search **PDF** files | ||
- **PDF** editing & annotations | ||
- Get **PDF** metadata information | ||
- Manage **PDF** passwords | ||
- Supports basic CJK (Chinese, Japanese, Korean) fonts | ||
## Getting started using NPM | ||
@@ -16,32 +21,62 @@ | ||
npm install mupdf | ||
```bash | ||
npm install mupdf | ||
``` | ||
To verify your installation you can create a file "test.js" with the following script: | ||
To verify your installation you can create a file `test.js` with the following script: | ||
const mupdf = require("mupdf") | ||
console.log(mupdf) | ||
```js | ||
const mupdf = require("mupdf") | ||
console.log(mupdf) | ||
``` | ||
Then, on the command line, run: | ||
node test.js | ||
```bash | ||
node test.js | ||
``` | ||
If all is well, this will print the `mupdf` module object to the console. | ||
## Loading a document | ||
### Loading a document | ||
The following example demonstrates how to load a document and then print out the page count. | ||
Ensure you have a "my_document.pdf" file alongside this example before trying it. | ||
Ensure you have a `my_document.pdf` file alongside this example before trying it. | ||
const fs = require("fs") | ||
const mupdf = require("mupdf") | ||
var data = fs.readFileSync("my_document.pdf") | ||
var doc = mupdf.Document.openDocument(data, "application/pdf") | ||
console.log(doc.countPages()) | ||
```js | ||
const fs = require("fs") | ||
const mupdf = require("mupdf") | ||
var data = fs.readFileSync("my_document.pdf") | ||
var doc = mupdf.Document.openDocument(data, "application/pdf") | ||
console.log(doc.countPages()) | ||
``` | ||
## License | ||
## License and Copyright | ||
AGPLv3 or later. See https://www.mupdf.com/licensing/ for more details. | ||
**MuPDF.js** is available under [open-source AGPL](https://www.gnu.org/licenses/agpl-3.0.html) and commercial license agreements. If you determine you cannot meet the requirements of the **AGPL**, please [contact Artifex](https://artifex.com/contact/mupdf-inquiry.php) for more information regarding a commercial license. | ||
## Documentation | ||
For documentation please refer to https://mupdf.readthedocs.io/. | ||
For documentation please refer to: [mupdf.readthedocs.io](https://mupdf.readthedocs.io/en/latest/mupdf-js.html). | ||
## Examples | ||
Check the [Github repo](https://github.com/ArtifexSoftware/mupdf.js) for example implementations including a simple **PDF Viewer** to help you get started. | ||
--- | ||
## Getting Started with Local Development | ||
You can build the **MuPDF.js WebAssembly** libraries from source by referring to [BUILDING.md](https://github.com/ArtifexSoftware/mupdf.js/blob/master/BUILDING.md). | ||
From here you can then try adding code to the main library file `mupdf.js` or adding your own **JavaScript** files or implementations. | ||
## Contributing | ||
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](https://discord.gg/zpyAHM7XtF) to chat with us directly. | ||
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
9647075
9217
82
1
6