Polotno

POLOTNO SDK VS PDF-LIB

Polotno SDK vs pdf-lib – byte-level editing vs a design schema

pdf-lib modifies an existing PDF's objects directly. Polotno SDK parses a PDF into an editable design and writes a new one. Which you want depends on whether the original file's structure must survive.

pdf-lib is a pure JavaScript library for creating and modifying PDFs at the document-object level. It can open an existing file, fill its form fields, copy pages between documents, and save it back with the rest of the structure intact. Polotno SDK parses a PDF into a design schema, lets a person edit it on a canvas, and writes a fresh document. The difference that matters is what survives the round trip.

Pick the one that matches what must survive

Pick pdf-lib if…

  • Form fields must keep working. Reading, filling, and flattening AcroForms is a first-class feature there and unsupported here.
  • Bookmarks, links, and metadata must survive. A byte-level edit preserves the document's structure; a schema import rebuilds the page and drops it.
  • You are merging or splitting documents for real. copyPages moves pages between files without reinterpreting their content.
  • You want no licence and no runtime. It is MIT, dependency-free, and runs anywhere JavaScript does.
  • Fidelity to the original beats editability. Nothing is re-rendered, so nothing shifts.

Pick Polotno SDK if…

  • A person needs to edit the document visually. pdf-lib has no editing surface; the canvas is the whole point here.
  • The text needs to be genuinely editable. pdf-lib can draw new text onto a page but does not reflow or restyle the text already there. A schema import turns it into text elements you can change.
  • You are generating from templates and data. One design, many rows, rendered through the Cloud Render API.
  • You need formats beyond PDF. PNG, JPG, SVG, HTML, PPTX, GIF, and MP4 from the same schema.
  • You need print output. CMYK, spot colours, bleed, and PDF/X-4 from PDF export.

Preserving a file vs reinterpreting it

1. What "edit" means

pdf-lib edits the document. The original content streams stay as they are and you modify objects around them. Polotno reinterprets the document as a design, which is why the text becomes editable and also why the structure around it does not come along.

2. The round trip

Run a PDF through pdf-lib and out again and you get essentially the same file. Run one through Polotno and you get a new file rendered from a schema. That is a feature when the goal is to change the content and a liability when the goal is to preserve the artefact.

3. Merging

Both can merge, and they mean different things by it. pdf-lib's copyPages is a structural operation. Polotno's merge concatenates parsed pages into one design, preserving each page's own size but not its form fields, bookmarks, or links.

4. Who operates it

pdf-lib is a developer tool with no UI. Polotno is a product surface your users touch.

When pdf-lib is the right call

Anything where the input file's integrity matters. Filling a government form, adding a page to a signed contract, stamping a header onto documents you did not author, splitting a batch of statements. In all of those, reinterpreting the page would be the wrong move, and pdf-lib's refusal to do so is exactly why it fits.

It is also the right call when you simply need a small, free, dependency-free library and the task is mechanical.

A naming ambiguity worth knowing

Searches for "pdflib" hit two unrelated products: pdf-lib, the MIT JavaScript library this page compares against, and PDFlib, a long-standing commercial C library with bindings for several languages. If you are on a JVM or .NET stack and someone recommends "PDFlib", check which one they mean.

FAQ

Can Polotno fill PDF form fields?

No. AcroForm widgets are not parsed as interactive fields. That is pdf-lib's job.

Can pdf-lib edit existing text?

Only in a limited sense. It can draw new text over a page, but the text already in the content stream is not exposed as editable, reflowable content. If a user needs to correct a sentence in an existing PDF, that is where a schema import earns its cost.

Which one preserves the original layout better?

pdf-lib, by a wide margin, because it does not re-render anything. Polotno's import is high fidelity but it is still an interpretation, and unusual fonts, ligature-heavy scripts, and complex transparency can shift.

Can I use both?

Yes, and it is a sensible split. Polotno for the authoring and design surface, pdf-lib for structural work on files you did not create.

Does Polotno compress PDFs?

No. Re-rendering through a schema is not a file-size optimisation pass and should not be treated as one.

Embed creative infrastructure into your product

TRUSTED BY

100,000+

CREATORS

300+

BUSINESSES

ExpediaUnbounceLovePopPostGridPredis.ai