Docs
Getting started
One Rust engine, the same functions on every platform. Pick yours.
Before you start
- Every call blocks until it is done. Keep calls off the main thread.
- Pages are counted from 0 in the API. (Page lists typed by people, like
"1-3, 7", start at 1;parse_page_rangeconverts them.) - Failures come back as
PagewerkError: the file cannot be read, the engine refused, or the password is wrong. - Without a licence key, results carry the evaluation mark.
The engine is not on a public package registry yet. Write to hello@pagewerk.app for an evaluation build.
Swift: iOS, iPadOS, macOS PRODUCTION
- Add
PagewerkEngine.xcframeworkand the generatedpagewerk_ffi.swiftto your target. - At launch, hand over your key with
setLicense(key:). - Optional: give the engine its bundled PDFium with
pdfiumInit(path:). Without it every tool still works; repair and redaction do less.
let status = setLicense(key: "EL1.…")
Task.detached {
let out = try compress(input: data, level: .strong)
// out.bytes, out.bytesIn, out.bytesOut, out.keptOriginal
}
C#: Windows PRODUCTION
The bindings live in the Pagewerk namespace; the free functions are static methods on Engine, errors are PagewerkException. Ship pagewerk_ffi.dll next to your app.
using Pagewerk;
var outcome = await Task.Run(() => Engine.Compress(bytes, CompressLevel.Strong));
How a key is bound to a Windows app is still being settled. Write to us before you plan a Windows release.
Web: WebAssembly PRODUCTION
The engine is served from our CDN, one immutable folder per version. It runs in a Web Worker, so the page stays responsive, and documents never leave the browser.
const base = "https://cdn.pagewerk.app/engine/0.1.0-e9147c0/";
const { load } = await import(base + "pagewerk.js");
const engine = await load({ base, license: "EL1.…" });
const { files, report } = await engine.run("compress", {
files: [{ name: file.name, bytes: new Uint8Array(await file.arrayBuffer()) }],
options: { level: "strong" },
onProgress: (f) => bar.value = f, // 0…1
signal: controller.signal, // abort stops the work at once
});
// files: [{ name, bytes, mime }], report: e.g. { bytesIn, bytesOut, evaluationMark }
- URL pattern:
https://cdn.pagewerk.app/engine/<version>/. This site uses0.1.0-e9147c0. - Tools:
merge,split,compress,rotate,delete-pages,extract-pages,organize,image-to-pdf,protect,unlock,page-numbers,watermark,repair,privacy-check,pdf-to-image,pdf-to-word,pdf-to-excel,crop.engine.toolslists what the loaded build offers. - The core loads first. The renderer part (PDFium, the largest part) loads the first time a tool needs it, for example PDF to image, Word or Excel, and crop.
- Errors carry a
code(for examplerefused,unreadable,wrong-password,too-many-pages,no-tables,fonts-unavailable) and amessageto show. - Your page’s Content Security Policy needs
worker-src blob:, the CDN inscript-srcandconnect-src, and'wasm-unsafe-eval'; the CDN also infont-src, because stamp text the standard fonts cannot spell loads Lato from the same folder.
Each tool’s options are on its demo: Demo.
Rust: Linux and servers COMING
The crate is the same surface the bindings expose: the Rust signature on every reference page is the one it will have. It is published later; until then, talk to us.