EPUB to PDF API – Convert eBooks to PDFs
Convert EPUB eBooks to PDFs instantly. Perfect layout preservation, table of contents support, no code complexity needed.
curl -X POST "https://api.xspdf.com/v1/convert/epub-to-pdf" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input_url": "https://files.example.com/ebook.epub",
"options": {
"format": "A4",
"font_size": 12,
"preserve_toc": true
}
}' EPUB Conversion Is a Nightmare
Format Complexity
EPUB is a zipped bundle of HTML, CSS, images, and metadata. Extracting content and rendering it correctly requires parsing NCX files, OPF manifests, and nested XHTML.
Broken Layouts
Images overflow pages. Fonts don't embed. Table of contents disappears. Chapter breaks land in the wrong places. Every eBook publisher formats EPUBs differently.
Tool Limitations
Calibre requires a full GUI environment. Pandoc produces ugly output. Custom solutions mean maintaining ZIP parsers, XHTML renderers, and CSS engines yourself.
Hidden Cost
Publishers need PDF versions for print-on-demand. Libraries need PDFs for archiving. Readers want PDFs for printing. Your team spends weeks building a converter that still produces broken output for 20% of books.
Upload EPUB. Get Perfect PDF.
Upload EPUB File
Pass a URL or base64-encoded EPUB file. We handle EPUB 2 and EPUB 3 formats. Reflowable and fixed-layout books both supported.
Configure Output
Choose page size, font size, margins, and whether to preserve table of contents. Optionally embed all fonts for perfect reproduction.
Get Print-Ready PDF
Receive a beautifully formatted PDF with proper chapter breaks, embedded images, working TOC links, and embedded fonts.
response = requests.post(
"https://api.xspdf.com/v1/convert/epub-to-pdf",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"input_url": "https://files.example.com/ebook.epub",
"options": {"format": "A4", "font_size": 12, "preserve_toc": True}
}
)
pdf_url = response.json()["output_url"] Professional eBook Conversion
EPUB 2 & 3 Support
Handles both EPUB 2 and EPUB 3 standards. Parses NCX, OPF, and XHTML correctly. Supports reflowable and fixed-layout books.
Table of Contents
Extracts and preserves chapter structure. Creates clickable PDF bookmarks. Page numbers align with original navigation.
Perfect Images
Embeds all images at full resolution. Maintains aspect ratios. Positions images correctly relative to text. No missing or broken graphics.
Font Embedding
Embeds custom fonts used in the EPUB. Falls back gracefully to system fonts. Preserves italic, bold, and special typography.
Flexible Layouts
Choose A4, Letter, or custom page sizes. Adjust font size and margins. Control line spacing and paragraph indentation.
Fast Processing
560ms median conversion time. Handles 500-page books without slowdowns. Process entire book catalogs in minutes.
Frequently Asked Questions
What EPUB versions are supported?
Both EPUB 2 and EPUB 3 formats. We support reflowable content and fixed-layout books. DRM-protected EPUBs are not supported (you must remove DRM first).
Will the table of contents be preserved?
Yes. We extract the EPUB table of contents and convert it to PDF bookmarks. Readers can navigate chapters using standard PDF viewer navigation panels. Set preserve_toc: true in options.
Can I adjust font size for readability?
Yes. Use the font_size option to set base text size in points. Common values: 10 for compact, 12 for standard, 14 for large print. Layout adjusts automatically.
Are images and fonts embedded?
Yes. All images are embedded at full resolution. Custom fonts are embedded if embed_fonts: true is set. This ensures the PDF looks identical on all devices.
What's the maximum file size?
Standard plans support EPUB files up to 50MB. Enterprise plans support up to 200MB. Typical novels are 2-5MB. Image-heavy books can be 20-30MB.
Convert Your First EPUB in Under 5 Minutes
Join 8,700+ teams using xspdf for eBook publishing and distribution. Free API key. No credit card required.
Related APIs