./serve.sh in this directory.
npm install @pdfcora/node
A thin layer over @pdfcora/web rather than a second implementation: the
whole web API is re-exported, so anything the web SDK does — annotations, form
filling, redaction, tagging, signatures, viewer state, the AI package, the agent tools
— works unchanged on the server. The same WebAssembly engine, so nothing to compile.
import { writeFile } from 'node:fs/promises';
import { openFile, renderPng } from '@pdfcora/node';
const doc = await openFile('contract.pdf');
await writeFile('page-1.png', await renderPng(await doc.page(0), { width: 1024 }));
openFile(path, password?) // read and open in one call saveFile(doc, path, mode?) // save straight to disk renderPng(page, options?) // encoded PNG bytes renderRaw(page, options?) // the raw RGBA buffer, for sharp or canvas
The web SDK takes a CMS implementation you supply; on Node that can be a JCA-style library, an HSM client or a remote signing service.
const signed = await doc.sign({
// Return a CAdES-BES CMS, or pass subFilter: 'adbe.pkcs7.detached' for plain PKCS#7.
signer: { async sign(data) { /* ... */ } },
reason: 'Approved',
});
The MCP server in mcp/ runs over stdio and exposes reading, proposals and
an apply that takes only the ids a person accepted.