
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@dicepdf/core
Advanced tools
Portable, privacy-first PDF engine. The same operations that power dicepdf.com — runnable in Node, the browser, and AI agents. Your files never leave the machine.
The portable PDF engine behind dicepdf.com. The same operations that power the website, packaged as pure functions you can call from Node, the browser, a CLI, or an AI agent.
One promise: your files never leave the machine. Every function reads bytes you already hold in memory and returns new bytes. There is no network path, no upload, no telemetry.
npm install @dicepdf/core
import { readFile, writeFile } from 'node:fs/promises';
import { merge, splitByRanges } from '@dicepdf/core';
import { extractText } from '@dicepdf/core/extract';
import { renderToImages } from '@dicepdf/core/render';
// Merge
const a = await readFile('a.pdf');
const b = await readFile('b.pdf');
await writeFile('merged.pdf', await merge([a, b]));
// Extract text (great for feeding an LLM/agent)
const text = await extractText(await readFile('report.pdf'));
// Render pages to PNGs
const images = await renderToImages(await readFile('report.pdf'), { dpi: 150 });
for (const img of images) await writeFile(img.name, img.bytes);
// Split
const parts = await splitByRanges(await readFile('book.pdf'), [
[1, 10],
[11, 20],
]);
for (const part of parts) await writeFile(part.name, part.bytes);
Every operation accepts a Uint8Array or ArrayBuffer and (for PDF
outputs) returns a Uint8Array.
| Import | Runs in | Pulls in |
|---|---|---|
@dicepdf/core | browser + Node | pdf-lib, fflate only — light & bundler-safe |
@dicepdf/core/extract | Node | pdfjs-dist (layout-aware text extraction) |
@dicepdf/core/render | Node | @napi-rs/canvas (optional) for rasterization |
The main entry has no node: imports, so it bundles cleanly into a browser
or web-worker build. render needs the optional @napi-rs/canvas
dependency (prebuilt — no native toolchain required).
| Function | Description |
|---|---|
merge(files) | Concatenate PDFs in order |
splitByRanges(file, ranges) / splitPages(file, pages) / splitEveryPage(file) | Split into multiple PDFs |
rotate(file, angle, pageIndices?) | Rotate 90/180/270° |
deletePages(file, pages) | Remove 1-based pages |
reorder(file, order) | Reorder via a page permutation |
crop(file, marginsMm) | Trim margins (millimeters) |
watermark(file, options) | Stamp a text watermark |
addPageNumbers(file, options) | Stamp page numbers |
stripMetadata(file, options?) | Remove Info/XMP/ID metadata |
compress(file) | Structural compression + metadata strip |
repair(file) | Best-effort reparse + rewrite |
imageToPdf(images, options?) | PNG/JPEG → PDF (one image per page) |
zip(entries) | Bundle named byte arrays into a ZIP |
getMetadata(file) | Page count, AcroForm, signature flag |
extractDocument / extractText / extractMarkdown | Layout-aware text extraction (/extract) |
renderToImages(file, options?) | Rasterize pages to PNG/JPEG (/render) |
compressAggressive(file, options?) | Rasterizing compression for scan-heavy PDFs (/render) |
Errors are typed: catch EncryptedPdfError and InvalidPdfError to branch
on bad input.
MIT
FAQs
Portable, privacy-first PDF engine. The same operations that power dicepdf.com — runnable in Node, the browser, and AI agents. Your files never leave the machine.
The npm package @dicepdf/core receives a total of 7 weekly downloads. As such, @dicepdf/core popularity was classified as not popular.
We found that @dicepdf/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.