What it really costs to put a PDF viewer and editor in a web app (PDF.js vs the commercial SDKs)
If you have ever been asked to "just show the PDF in the app", you know how that ticket goes. Viewing takes an afternoon. Then somebody asks for highlights. Then form filling. Then signatures.
Then, one day, a customer wants to fix a typo in a contract without leaving your product, and you find out that changing the text that is already inside a PDF is a completely different problem from drawing on top of it.
We build a PDF SDK (Kernstra), so yes, this post is written by a vendor, and you should read it with that in mind. I have tried to make it useful anyway: where PDF.js is the right answer, where the commercial SDKs are ahead of us, and what the commercial ones actually cost, because that last part is surprisingly hard to find out.
First: you might not need an SDK at all
If your users only need to read a PDF, use PDF.js. It is free, Apache-licensed, community-driven with Mozilla behind it, and it is the viewer inside Firefox. Its viewer has also picked up basic annotation tools over the years, such as highlights, free text, drawing and images.
If you need to generate or stitch PDFs from code, pdf-lib does that well, and the two together cover a lot of ground.
Where teams usually hit the wall:
- Editing existing text. Not a text box over the page, but changing the words already in the file, in the same font, with the paragraph rewrapping.
- A complete UI.
PDF.jsgives you a renderer and a reference viewer. A comments panel with replies, a page manager, a signature flow, a phone layout: you build those. - Forms that behave. Calculated fields, signature fields, saving flattened or still editable.
- Somebody to email when a customer's scanned 300-page file renders wrong.
If none of that is on your roadmap, close this tab and ship PDF.js. Honestly.
What the commercial SDKs cost
This is the part that annoyed us enough to start a company. Here is how the web SDKs we get compared with are sold, from each vendor's public pages and public pricing data (read on 27 October 2026, Nutrient's on 10 November 2026; prices change, so check before you rely on any of it):
| Published price | Month to month? | Editing existing text | |
|---|---|---|---|
| Nutrient (formerly PSPDFKit) | None, quoted by sales | No, one-year license | Content Editor component |
| Apryse (formerly PDFTron) | Packages from $1,500 a year, then quoted | No, buyers report a year or longer | PDF Editing add-on |
| ComPDF | "Starting at $1,300", then quoted | No, one-year license at its reseller | Content Editor, priced by feature |
| Syncfusion | $599 per developer a year | One year, payable monthly | Not in the viewer |
| Kernstra | From $149 a month | Yes, cancel any month | Included in the entry plan |
Two things to be fair about. First, these are good products, and in several places they do more than we do: certificate-based digital signatures, true redaction, OCR, Office formats, form building, document comparison, real-time collaboration. If you need one of those today, one of them is your answer, not us.
Also worth knowing: Syncfusion has a free Community License for very small companies (under $1M in revenue and five developers or fewer, among other conditions). If you qualify, that is hard to beat on price. ComPDF has a community license too.
Second, "quoted by sales" is not a crime. Big deals are genuinely different from each other. But if you are a small team trying to find out whether a document feature is even affordable, a contact form and a year-long commitment before your first line of code is a rough way to start.
We keep the long version, with a source link for every row, on our comparison pages, and we correct anything that turns out to be wrong.
What we did differently
Kernstra is one npm package that runs entirely in the browser. It is not built on PDF.js: it uses the PDF engine Chromium uses, compiled to WebAssembly. There is no server component, and documents are never uploaded anywhere.
It makes two kinds of request to us: a license check, which carries no document content, and downloads of the engine and fonts, which send no data at all.
The pricing is the part I would most like you to steal if you ever sell a developer tool:
- $149 a month for an internal or back-office app, with all 26 tools included. A bigger plan adds apps and users. It never unlocks a tool.
- Monthly billing with no minimum term. Quarterly and yearly are there too, and yearly is billed as ten months.
- Development keys are free and do not expire. They watermark the output, and they work on localhost and any HTTPS host, so you can build the integration before anybody talks about money. One catch: on a free account's key, reading content out through the API (extracting or searching text, form values) and copying text are switched off.
- Public-facing apps are priced by quote, and you get the number within one business day.
I am not going to pretend the $149 covers a consumer app with 50,000 users. It does not. It is a commercial license, not open source. I would rather say that here than have you find it in the comments.
The code
Install it:
npm install @kernstra/pdf-web-sdk
A viewer in plain TypeScript:
import { Kernstra, PDFDocument, PDFViewer } from '@kernstra/pdf-web-sdk';
// Once per page load. Checks your key and loads the engine.
await Kernstra.init({
license: import.meta.env.KERNSTRA_LICENSE,
});
// Open a document. Nothing about it leaves the browser.
const doc = await PDFDocument.fromUrl('/reports/q3-board-pack.pdf');
// Any element with a height will do.
const container = document.getElementById('viewer')!;
new PDFViewer(container, doc, {
toolbar: { layout: 'ribbon' },
});
If you use Vite, add envPrefix: ['VITE_', 'KERNSTRA_'] to vite.config.ts so the browser code can read that variable, and set build.target to es2022 or later.
The same thing as a React component, with cleanup that survives Strict Mode:
import { useEffect, useRef } from 'react';
import { Kernstra, PDFDocument, PDFViewer } from '@kernstra/pdf-web-sdk';
const initKernstra = () => Kernstra.init({ license: import.meta.env.KERNSTRA_LICENSE });
export function DocumentViewer({ url }: { url: string }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
let canceled = false;
let doc: PDFDocument | undefined;
let viewer: PDFViewer | undefined;
(async () => {
await initKernstra(); // safe on every mount
const opened = await PDFDocument.fromUrl(url);
if (canceled) {
await opened.close();
return;
}
doc = opened;
viewer = new PDFViewer(ref.current!, doc);
})().catch(console.error);
return () => {
canceled = true;
viewer?.destroy();
void doc?.close();
};
}, [url]);
return <div ref={ref} style={{ height: '80vh' }} />;
}
There are equivalent examples for Next.js, Vue, Nuxt, Angular, Svelte and SvelteKit in the get started guide.
The bit I am proudest of: editing real text
A PDF does not store paragraphs. It stores text objects, each with a font, a size and a position. Kernstra reads those, groups them into the lines and blocks a person would recognize, and writes your change back in the font already embedded in the file. The paragraph rewraps in place and the rest of the page does not move.
Users do this by clicking into the text. You can also do it from code (this one reads text through the API, so it needs a key from a paying account):
await viewer.activateTool('editText');
const editText = viewer.tools.editText;
const blocks = await editText.listBlocks(3);
const term = blocks.find((b) => b.text.includes('thirty-six months'));
if (term) {
await editText.setText(
term.id,
term.text.replace('thirty-six', 'twenty-four'),
);
await editText.commit(); // repaints, one undo step
}
One limitation, since we are being honest: Arabic, Hebrew and Indic scripts are shaped correctly, but a single line that mixes right-to-left and left-to-right text is not laid out in both directions yet.
Big files
Real documents are big: scanned claim bundles, maintenance manuals, a year of statements. If your server answers HTTP range requests, the viewer opens before the download finishes:
const doc = await PDFDocument.fromUrlProgressive(
'/scans/site-survey-2026.pdf',
{ onProgress: (loaded, total) => setProgress(loaded / total) },
);
In our own test, a 107 MB file of 100 scanned pages opened after about 0.2 MB had arrived, and the first page was on screen after about 6 MB. That was measured on a laptop with the file served locally, so treat it as "how little of the file it needs", not as a promise about your users' network.
Try it without talking to anyone
Open your own PDF in the playground. No account, and the file is not uploaded.
Get started guide, with a free development key. Pricing, if you want the details of what I summarized above.
If you have shipped PDF features with PDF.js or one of the SDKs in the table, I would like to hear what hurt the most. And if I got something wrong about a competitor, tell me in the comments and I will fix it.
Comments
No comments yet. Start the discussion.