GUIDES

Installation

Use built JavaScript ES modules and maintained TypeScript declarations in your application. No runtime package dependencies to install alongside MinkPDF.

Install the package#

Terminal
npm install minkpdf
# Or choose your package manager:
pnpm add minkpdf
yarn add minkpdf
bun add minkpdf

Use one command for your package manager. The package includes built JavaScript ES modules and maintained .d.ts declarations. Use ESM imports.

TypeScript
import pdf from 'minkpdf';
import type { TDocumentDefinitions } from 'minkpdf/interfaces';

const definition: TDocumentDefinitions = { content: 'Hello' };
const bytes = await pdf.createPdf(definition).getBuffer();

Runtime requirements#

The engine uses native CompressionStream with deflate, Blob, Response, TextEncoder, atob, and btoa. PNG decoding also needs DecompressionStream.

RuntimeVerified in this repository
Bun 1.4.0Full-engine tests and README file-generation examples
Bun 1.4.2Full suite including feature regressions, packed-package, and consumer tree-shaking checks
Node.js 24.12.0README file-generation examples using the built ES modules
ChromiumManual browser verification: printable-PDF navigation and closed-target URL cleanup; lifecycle unit tests cover printing

The Node.js and Chromium observations were recorded on 8 October 2026. The JavaScript suite and Bun 1.4.2 measurements were checked on 1 November 2026. These observations are not minimum version guarantees or fresh browser certification. Bun is needed to build this repository, but consumers use the built ES modules.

Include only the capabilities you need#

The root import enables historical tables, images, and TrueType fonts. Advanced report, graphics, security, and output capabilities require their own factories. For ASCII text with Helvetica, use minkpdf/core.

JavaScript
import { createPdf } from 'minkpdf/core';

const bytes = await createPdf({ content: 'Hello' }).getBuffer();

For a report with tables and Unicode text, compose an independent engine with two features.

JavaScript
import { createPdfEngine } from 'minkpdf/core';
import { tables } from 'minkpdf/tables';
import { trueTypeFonts } from 'minkpdf/truetype';

const pdf = createPdfEngine({ features: [tables(), trueTypeFonts()] });
// Register fonts on this engine before requesting a Unicode PDF.
ImportWhat it provides
minkpdfHistorical root: text, tables, images, and TrueType fonts
minkpdf/corecreatePdf(), createPdfEngine(), engine/document/feature types
minkpdf/tablestables() feature factory
minkpdf/imagesimages() feature factory
minkpdf/truetypetrueTypeFonts() feature factory
minkpdf/reportsreports() · links, references, advanced typography and pagination
minkpdf/listslists() · ordered, unordered and nested lists
minkpdf/toctoc() · generated contents and final page numbers
minkpdf/columnscolumns() · equal-width snaking columns
minkpdf/graphicsgraphics() · vector shapes, strokes and clipping
minkpdf/svgsvg() · the declared SVG profile
minkpdf/qrqr() · vector QR codes
minkpdf/standard-fontsstandardFonts() · standard PDF font metrics and encodings
minkpdf/shapingshaping() · bounded Latin glyph shaping
minkpdf/patternspatterns() · uncolored tiling patterns
minkpdf/attachmentsattachments({vfs}) · explicit embedded files
minkpdf/encryptionencryption() · R6 AES-256
minkpdf/archivalarchival() · supported PDF/A and PDF/UA profiles
minkpdf/taggedtagged() · semantic document structure
minkpdf/streamingstreaming() · incremental serialization
minkpdf/resourcesprepareDocumentResources(), prepareFontResources()
minkpdf/browser-outputdownloadPdf(), openPdf()
minkpdf/nodewritePdf(), bufferedPdfStream(); Node-only adapter
minkpdf/interfacesDocument definition types; use import type

The factories tables(), images(), trueTypeFonts(), and the other content/document factories select their report backend automatically. reports() enables advanced semantics without adding those content factories. standardFonts() supplies fonts only and does not select a report backend. Standalone resource and output helpers are imported directly, rather than placed in features.

Application bundlers remove unreferenced modules. Feature selection happens when creating the engine; it is not inferred from runtime document content. See the measured consumer bundle sizes.

Serve ES modules without a bundler#

Build the repository or obtain the package’s built dist/ directory. Copy the entire module tree to your static server, for example under /vendor/minkpdf/. Keep the nested folders and relative imports intact.

HTML
<script type="module">
  import pdf from './vendor/minkpdf/index.js';
  const blob = await pdf.createPdf({ content: 'Hello' }).getBlob();
  console.log(blob.type); // application/pdf
</script>

Serve the page over HTTP(S). A bare import such as 'minkpdf' needs a bundler or import map. Copying only index.js will lose the shared modules it imports.

Build from source#

Terminal
git clone https://github.com/accntech/minkpdf.git
cd minkpdf
# Use Bun 1.4.2, matching packageManager
bun run build

TypeScript consumers use maintained declarations with TypeScript 5.7.3 or newer and ES2022/DOM library definitions; the Node adapter also needs @types/node. Packed consumers have been checked with 5.7.3, stable 7.0.2, and next 7.1.0-dev.20261031.1. CI requires the baseline and latest stable; nightly checks are advisory. JavaScript consumers need no TypeScript compiler.

Building from source requires Bun. The build copies the maintained public declarations alongside the JavaScript modules without invoking a TypeScript compiler. Compatibility tests use Node.js, npm, and isolated compiler installations. Published type exports resolve to .d.ts files, so consumers do not compile MinkPDF’s implementation.

The complete suite requires Poppler (pdfinfo, pdftotext, pdfimages), Python with pikepdf, HarfBuzz hb-shape, an isolated QR-decoder Python environment selected with MINKPDF_QR_DECODER_PYTHON, and veraPDF 1.30.3 selected with MINKPDF_VERAPDF or PATH. Package tests also need Node.js, npm, and registry access. See the contributing guide for the complete setup; the Poppler commands below are only one part.

Terminal
# macOS
brew install poppler
# Debian / Ubuntu
sudo apt-get install poppler-utils

bun test

Package and tree-shaking checks use pinned tooling in temporary consumers and require Node.js, npm, and registry access. See the contributing guide for the complete development workflow.

Search pages, examples, and API methods.