7 best document generation libraries for JavaScript in 2026
The 7 best JavaScript libraries for generating PPTX, PDF, DOCX, and XLSX files in 2026. Covers PptxGenJS, pdfmake, ExcelJS, docx, Carbone, Aspose, and PaperJSX. Stars, downloads, chart support, pricing, and maintenance status compared.
The JavaScript document generation ecosystem is split: no single free library handles PPTX, PDF, DOCX, and XLSX. PptxGenJS dominates PowerPoint (1.27M weekly downloads), pdfmake dominates PDF (1.3M), ExcelJS dominates XLSX (5.5M) but has zero chart support, and the docx package handles Word (2.1M). Carbone and PaperJSX are the only multi-format options. This guide covers all 7, with honest assessments of strengths, limitations, and when to use each.
Overview table
| Library | Formats | Stars | npm DLs/wk | Charts | Browser | License | Price |
|---|---|---|---|---|---|---|---|
| PptxGenJS | PPTX | 5K | 1.27M | Yes (combo, 3D) | Yes | MIT | Free |
| pdfmake | 12.2K | 1.3M | No (image only) | Yes | MIT | Free | |
| ExcelJS | XLSX | 15.2K | 5.5M | No (10 yrs) | Yes | MIT | Free |
| docx | DOCX | 5.5K | 2.1M | No | Yes | MIT | Free |
| Carbone | 15+ | 1.9K | Low | Via template | No | CE / Paid | From $29/mo |
| Aspose | 20+ | N/A | N/A | Yes (all) | No | Proprietary | From $1,199/yr |
| PaperJSX | 4 | New | New | Yes (native) | No | MIT + Pro | Free / $149/mo |
1. PptxGenJS
PPTX · free · browser + server
PptxGenJS is the most popular JavaScript library for generating PowerPoint presentations. It has 5,000 GitHub stars, 1.27 million weekly npm downloads, and is actively maintained — the latest release, v4.0.1, shipped in June 2025.
Strengths: Widest chart type support among open-source PPTX libraries (bar, line, pie, scatter, area, doughnut, radar, bubble, combo, 3D). Works in all modern browsers, Node.js, React, Angular, Vite, and Electron. HTML-to-PPTX table conversion. Dual ESM/CJS builds. Only dependency: JSZip. MIT licensed.
Limitations: PPTX only — no PDF, DOCX, or XLSX. Slide animations are explicitly not on the roadmap. Single maintainer (Brent Ely). Some edge cases with repair dialogs in hyperlinked auto-paged tables (fixed in v4.0.1).
Best for: PPTX-only use cases, browser-side generation, teams wanting a free and proven library. For a detailed comparison, see PptxGenJS vs python-pptx vs PaperJSX.
2. pdfmake
PDF · free · browser + server
pdfmake is the most popular JSON-to-PDF library for JavaScript. It has 12,200 GitHub stars, 1.3 million weekly downloads, and is actively maintained — v0.3.7 shipped in March 2026 with a security fix for CVE-2026-26801.
Strengths: Declarative JSON API (similar philosophy to PaperJSX). Works in both browsers and Node.js. Supports headers, footers, columns, tables of contents, watermarks, and custom fonts. Large community and extensive documentation. MIT licensed.
Limitations: PDF only. No native chart support (images only). Tables wider than the page overflow without warning (issue #441, open since 2015). rowSpan breaks across pages. Images require base64 encoding.
Best for: PDF-only use cases, browser-side PDF generation, teams wanting a free JSON-first library with large community adoption. See PaperJSX vs pdfmake for a detailed comparison.
3. ExcelJS
XLSX · free · browser + server
ExcelJS is the most downloaded XLSX library for JavaScript with 5.5 million weekly downloads
and 15,200 GitHub stars. It handles cells, formulas, styling, conditional formatting, tables, images, and streaming writes.
Strengths: Rich cell formatting API. Data validation. Streaming writes for large files. Tables with auto-filter. Good TypeScript support. MIT licensed.
Limitations: Zero chart support — the feature has been requested since June 2016 (issue #141, 10 years). Cannot even preserve charts when reading and writing existing files (issue #1734). Deprecated transitive dependencies (issue #2882).
Best for: XLSX generation without charts — data exports, spreadsheets with formulas and styling, streaming large datasets. Not suitable for any use case requiring embedded charts.
4. docx
DOCX · free · browser + server
The docx npm package generates Word documents from JavaScript. It has 5,500 GitHub stars
and 2.1 million weekly downloads. The API is builder-pattern based — you construct paragraphs, tables, and sections using chained method calls.
Strengths: Clean TypeScript API. Supports headers, footers, page numbers, tables of contents, images, hyperlinks, and bookmarks. Works in browsers and Node.js. MIT licensed.
Limitations: DOCX only. No chart support. No template system — every element must be constructed programmatically. The documentation site has weak SEO presence (low domain authority). The API is verbose for complex layouts.
Best for: DOCX-only generation from code. Contracts, letters, reports, and any document where the content is entirely data-driven. Not ideal for template-based workflows (use Carbone or docxtemplater instead).
5. Carbone
15+ formats · paid · server only
Carbone is a template-based document generation platform. It has 1,900 GitHub stars, a 4.8/5 rating
on Capterra, and SDKs in Node.js, Go, PHP, Java, Python, Rust, and JavaScript.
Strengths: Design templates in Word, Excel, or LibreOffice — no code needed for layout. 15+ output formats. Pre-built integrations with Salesforce, HubSpot, Zapier, Make, N8N, Airtable, Bubble. MCP server for AI agents. Excellent customer support (per reviews).
Limitations: Requires LibreOffice for format conversion (Community Edition). Per-document pricing on Cloud plans. Template tag syntax has a learning curve. Server-side only.
Best for: Teams where non-technical users design document templates. Fixed-layout documents (invoices, contracts, certificates). No-code/low-code workflows. See PaperJSX vs Carbone.
6. Aspose
20+ formats · paid · server only
Aspose is the enterprise incumbent for document processing. It supports 20+ file formats across .NET, Java, Python, C++, and Node.js. Per-format pricing starts at $1,199/yr
per developer.
Strengths: Every chart type. Every format conversion. 20 years of production use. Enterprise support and SLAs. The most complete document API available.
Limitations: Per-format, per-developer pricing — 4 formats × 5 developers = $23,980/yr. Node.js SDK wraps .NET binaries (50–200 MB per format). Difficult serverless deployment. Separate products for each format.
Best for: Enterprise teams on .NET or Java with budget for per-seat licensing. Regulatory environments with pre-approved vendor lists. Use cases requiring 20+ format coverage. See PaperJSX vs Aspose.
7. PaperJSX
4 formats · free + paid · server only
PaperJSX is an open-core document generation engine that converts a single JSON schema into PPTX, DOCX, PDF, and XLSX. The core PPTX engine is MIT-licensed. Pro ($49/mo) adds charts and animations. All Formats ($149/mo) adds DOCX, PDF, and XLSX.
Strengths: One JSON schema → four output formats. Native editable charts in PPTX and XLSX. Pure JavaScript, zero native dependencies, under 5 MB total. MCP server for AI agents. Combo chart support. Flat-rate pricing (no per-document, no per-seat). Serverless compatible.
Limitations: New library, small community. Server-side only (no browser generation). PDF, DOCX, XLSX require paid plan. Cannot read or modify existing files. Four formats only (vs Carbone's 15+ or Aspose's 20+).
Best for: Multi-format generation from a single data source. AI agent document workflows. Teams that need PPTX + PDF + DOCX + XLSX without maintaining four separate libraries. See the quickstart tutorial.
Disclosure: PaperJSX is my product. I built it because the four-library stack described in this article — PptxGenJS + pdfmake + docx + ExcelJS — required maintaining four separate codepaths with four separate data transformations for the same report. This article evaluates all seven libraries on their merits, including PaperJSX's limitations.
Decision framework
| If you need… | Use | Why |
|---|---|---|
| PPTX only, free | PptxGenJS | Most complete PPTX feature set, browser + server, 1.27M DLs |
| PDF only, free, JSON API | pdfmake | Declarative JSON, browser + server, 12.2K stars |
| XLSX without charts, free | ExcelJS | Rich cell/formula API, streaming, 5.5M DLs |
| DOCX only, free | docx | Clean TypeScript API, browser + server |
| XLSX with charts, free | xlsx-chart | Only free option with native XLSX chart creation |
| Non-technical template design | Carbone | Design in Word/Excel, 15+ formats, no-code integrations |
| Enterprise, .NET/Java, 20+ formats | Aspose | Most complete API, every chart type, enterprise support |
| Multi-format from one JSON schema | PaperJSX | 1 schema → PPTX + DOCX + PDF + XLSX, pure JS |
| AI agent document generation | PaperJSX or Carbone | Both have MCP servers; PaperJSX: JSON-in; Carbone: template-based |
| Browser-side PDF or PPTX | pdfmake or PptxGenJS | Only options that work without a server |

