The PDF engine
The EmbedPDF engine opens PDF files in the browser and lets you render their pages, read and search their text, add annotations, fill forms, edit pages and save the result. It runs PDFium, the PDF library inside Chrome, in a Web Worker, so your page stays responsive. Nothing is uploaded: the file never leaves the device.
The ready-made viewer and the headless components are built on this engine. Use it directly when you want PDF features without a viewer: a thumbnail job, a form filler, an export script.
import { localEngine } from '@embedpdf/engine';
const engine = localEngine();
const doc = await engine.open({ kind: 'bytes', bytes });
const { pages } = await doc.pages.list();
const image = await doc.page(pages[0].ref).render.image();What you can do#
- Render pages as images, at any size.
- Read, search and select the text on a page, and find out where each character is.
- Add and edit annotations: highlights, notes, shapes, stamps, measurements. Copy them to another document with import & export.
- Fill forms, create form fields and sign documents.
- Change pages: rotate, reorder, delete, insert, merge and split.
- Redact content for good, and save the result.
- Group edits into changes that apply all or none, and undo or redo any of them.
Every call is async, can be cancelled, and fails with a typed error you can branch on. The same code runs on the local engine and on the CloudPDF engine: only how you create the engine and open a file differs.
A few things exist only on the local engine: its fonts, warmup(), raw pixels, and saving a
document’s layer or to a file. A document opened with localEngine() has them. Code that takes
any engine checks first:
import { isLocalDocument } from '@embedpdf/engine';
if (isLocalDocument(doc)) {
const layer = await doc.downloadLayer();
}isLocalEngine(engine) does the same for an engine.
Local or cloud#
This engine runs in the browser: no server, no upload, and it works offline. That makes it the right choice when the user already has the file, or when the file may not leave their device.
Next steps#
Your feedback goes directly to the documentation team.