PDFKit

Pure JavaScript PDF document generation library for Node.js and browser. PDFKit creates PDF documents programmatically — text, images, shapes, vector graphics, tables (via manual positioning), fonts, and hyperlinks. Outputs as a readable stream. Used for invoice generation, report PDFs, and any agent workflow that needs to produce PDF documents without conversion from HTML.

Evaluated Mar 06, 2026 (0d ago) v0.15+
Homepage ↗ Repo ↗ Developer Tools pdf generation node document stream text images vector no-native
⚙ Agent Friendliness
64
/ 100
Can an agent use this?
🔒 Security
94
/ 100
Is it safe for agents?
⚡ Reliability
83
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
80
Error Messages
72
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
82
Secret Handling
85

Pure JavaScript PDF generation. PDFKit supports PDF encryption for sensitive documents. No external service calls — fully local.

⚡ Reliability

Uptime/SLA
100
Version Stability
80
Breaking Changes
78
Error Recovery
75
AF Security Reliability

Best When

You need programmatic PDF generation from data in Node.js without Chromium/native binaries, and you're willing to do manual coordinate-based layout.

Avoid When

You need to convert HTML/CSS to PDF (use Puppeteer) or edit existing PDFs (use pdf-lib).

Use Cases

  • Generate invoice and report PDFs in agent billing systems using PDFKit's layout primitives for professional document output
  • Create structured data export PDFs from agent analysis results with consistent formatting using PDFKit's text/image composition
  • Build PDF generation pipelines in serverless environments where Puppeteer/Chrome-based PDF generation is too heavy
  • Produce multi-page agent report documents with page breaks, headers, footers, and table of contents using PDFKit's page management
  • Generate certificate PDFs, compliance reports, or signed documents in agent workflows requiring official PDF output format

Not For

  • HTML-to-PDF conversion — PDFKit generates PDFs programmatically, not from HTML; use Puppeteer or wkhtmltopdf for HTML rendering to PDF
  • PDF modification or merging — PDFKit creates new PDFs; use pdf-lib or pdf-merger for editing existing PDFs
  • Pixel-perfect layout from design files — PDFKit requires manual coordinate-based layout which is tedious for complex designs; use HTML-to-PDF for design fidelity

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — local PDF generation library. PDFKit supports password-protected PDF output.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

PDFKit is open source and free.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • PDFKit uses a stream-based API — pipe doc to a file WriteStream or buffer; forgetting doc.end() leaves the stream open and the PDF incomplete
  • Layout is coordinate-based — text wrapping, tables, and multi-column layouts require manual x/y positioning; there's no automatic layout engine
  • Custom fonts require embedding the full font file into the PDF — this increases file size significantly; subset fonts where possible
  • Images added with doc.image() are embedded in the PDF — large images create large PDFs; resize/compress images before embedding
  • doc.addPage() creates a new page but doesn't automatically add headers/footers — implement page events with doc.on('pageAdded') for consistent headers
  • PDFKit text encoding defaults to latin1 — use doc.font('path/to/unicode-font.ttf') and ensure font supports the character set for international text

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for PDFKit.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered