If you work with ebooks, documentation, or publishing pipelines, converting EPUB to PDF is a common requirement.
In this post, Iβll show you how to convert EPUB files to PDF using Calibre via a Node.js CLI and API that works on Linux, macOS, and Windows.
π Introducing epub-to-pdf-cli
epub-to-pdf-cli is a lightweight Node.js tool that wraps Calibreβs powerful ebook-convert command and exposes it as:
β A command-line tool
β A Node.js programmatic API
β Cross-platform utility (no bundled binaries)
π npm: https://www.npmjs.com/package/epub-to-pdf-cli
π GitHub: https://github.com/surajsutar7/epub-to-pdf-cli
β¨ Features
*Convert EPUB β PDF using Calibre
*
CLI + JavaScript API
Works on Linux, macOS, and Windows
No native bindings
Clear error handling
Ideal for automation & CI pipelines
π¦ Installation
Global CLI install
npm install -g epub-to-pdf-cli
Or run without installing
npx epub-to-pdf-cli book.epub
π₯ CLI Usage
epub2pdf [output.pdf]
Examples
epub2pdf mybook.epub
epub2pdf mybook.epub mybook.pdf
π Programmatic Usage (Node.js)
Install locally:
npm install epub-to-pdf-cli
Use in your code:
import { convertEpubToPdf } from 'epub-to-pdf-cli';
await convertEpubToPdf('book.epub', 'book.pdf');
β Requirements
This tool requires Calibre to be installed.
Verify installation:
ebook-convert --version
Install Calibre
Ubuntu / Debian
sudo apt install calibre
macOS
brew install calibre
Windows
Download from:
π https://calibre-ebook.com/download
β Common Errors & Fixes
ebook-convert: not found
β‘οΈ Calibre is not installed or not in PATH.
EPUB file does not exist
β‘οΈ Check input file path and permissions.
π§ Why Not Use a Pure JS Converter?
EPUB β PDF is complex:
Layout
Fonts
Pagination
CSS rendering
Calibre already solves these problems reliably.
This package simply gives you safe, scriptable access from Node.js.
π¦ Versioning & Stability
This project follows Semantic Versioning using Conventional Commits:
Commit Type Version
fix: Patch
feat: Minor
feat!: Major
Example:
git commit -m "feat!: change CLI input format"
π Ideal Use Cases
Ebook automation pipelines
Backend services
Batch conversions
Publishing workflows
CI/CD ebook processing
π License
MIT Β© Suraj Sutar
β Final Thoughts
If you need a reliable EPUB β PDF solution in Node.js without reinventing the wheel, this tool keeps things simple and production-ready.
β Star the repo if you find it useful
π Issues and PRs are welcome
Top comments (0)