The editor saves .docx. The SDK you installed with it, @runstamp/sdk, does the rest on your own server: it exports a .docx to PDF with the same layout engine the editor paginates with, fills a PDF form, and signs a PDF. It runs in your Node.js process, needs no key and sends nothing anywhere. The hosted API at $0.03 an output file runs the same operations on Runstamp's servers when you would rather not run them yourself.
Each snippet below is a whole file. Save one as pdf.mjs next to a contract.docx (the file from the editor quick start) or a PDF form, and run it with node pdf.mjs. Node.js 20 or later and npm install @runstamp/sdk are all it needs.
Export a Word file to PDF
import { readFileSync, writeFileSync } from 'node:fs';
import { createRunstamp } from '@runstamp/sdk';
const rs = createRunstamp();
const result = await rs.exportPdf(new Uint8Array(readFileSync('contract.docx')));
if (!result.ok) throw new Error(result.error.message);
writeFileSync('contract.pdf', result.value.bytes);
console.log('wrote contract.pdf', result.value.byteLength, 'bytes');The PDF has the page count the editor shows in its status bar.
Fill a PDF form
fill takes the PDF and an object of field names and values. To see a form's field names, fill with any one value and read result.value.output.inspection.fields; each has a name and a type.
import { readFileSync, writeFileSync } from 'node:fs';
import { createRunstamp } from '@runstamp/sdk';
const rs = createRunstamp();
const form = new Uint8Array(readFileSync('form.pdf'));
const first = await rs.fill(form, {});
console.log(first.value.output.inspection.fields.map((f) => `${f.name} (${f.type})`).join('\n'));
const result = await rs.fill(form, { 'topmostSubform[0].Page1[0].f1_01[0]': 'Harborview Property Group' });
if (!result.ok) throw new Error(result.error.message);
writeFileSync('form-filled.pdf', result.value.output.bytes);A name that is not in the form is refused with No AcroForm field named …, so a typo cannot fill the wrong field.
Sign a PDF
import { readFileSync, writeFileSync } from 'node:fs';
import { createRunstamp } from '@runstamp/sdk';
const rs = createRunstamp();
const result = await rs.sign(new Uint8Array(readFileSync('form-filled.pdf')), { name: 'Marcus Lee', reason: 'Approval' });
if (!result.ok) throw new Error(result.error.message);
writeFileSync('form-signed.pdf', result.value.bytes);The signature is a standard detached CAdES signature over the whole document, and pdfsig reports it as valid. The certificate is self-signed, so Acrobat shows the signer as unknown until your own certificate is configured.
Let an agent edit the Word file
The same package ships an MCP server, runstamp-mcp, that opens a .docx, suggests or makes changes as tracked changes by "Agent", and saves it. Start it with --agent; see MCP server.