# Engines in this directory

| Files | Engine | Version | Licence | Source |
|---|---|---|---|---|
| `gs-worker.wasm`, `gs-worker.js`, `background-worker.js` | Ghostscript | as built by laurentmmeyer/ghostscript-pdf-compress.wasm | AGPL-3.0 | https://github.com/laurentmmeyer/ghostscript-pdf-compress.wasm |
| `qpdf.wasm`, `qpdf.mjs` | qpdf | 12.4.2 (commit `4eba95899886e851cc41d76886483b347612f2a8`) | Apache-2.0 | https://github.com/qpdf/qpdf |

## qpdf build

Compiled from the tagged source with Emscripten 7.0.0 (`emscripten/emsdk@sha256:6bd7aef93408b10bf7b36642cb7c91119b302f720b9ec2d20439f73cf07fe894`), unmodified:

- `emcmake cmake` with `-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DREQUIRE_CRYPTO_NATIVE=ON -DUSE_IMPLICIT_CRYPTO=OFF -DCMAKE_CXX_FLAGS=-fexceptions -DCMAKE_C_FLAGS=-fexceptions`, zlib and libjpeg from the Emscripten ports;
- linked with `-fexceptions -sALLOW_MEMORY_GROWTH=1 -sMODULARIZE=1 -sEXPORT_ES6=1 -sEXPORT_NAME=createQpdf -sEXPORTED_RUNTIME_METHODS=FS,callMain -sENVIRONMENT=worker,node -sINVOKE_RUN=0 -sEXIT_RUNTIME=0 -sSTACK_SIZE=5MB`.

C++ exceptions are enabled (`-fexceptions`) so that qpdf reports an error, such as a wrong password or a damaged file, as an exit code and a message. Without it every error aborts the engine.

The SHA-256 of every file here is recorded in `manifest.security.json` and checked by `npm run security:wasm`.

qpdf is copyright Jay Berkenbilt and contributors, licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
