HTML to PDF & EPUB Converter — Raw HTML String to Files
Pricing
from $30.00 / 1,000 pdf/epub outputs
HTML to PDF & EPUB Converter — Raw HTML String to Files
Convert a raw HTML string into PDF (Playwright) and EPUB (chapters on h2). API-ready for docs, reports, and ebooks.
Pricing
from $30.00 / 1,000 pdf/epub outputs
Rating
0.0
(0)
Developer
Andres Sanabria
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a month ago
Last modified
Categories
Share
What it does
Turn a raw HTML string (html_content) into downloadable PDF and/or EPUB in one Apify run — no local Chromium setup.
- PDF via headless Playwright/Chromium (page-break friendly CSS, A4 / Letter / Legal)
- EPUB via BeautifulSoup + ebooklib (chapters split on
<h2>)
Ideal for: automated reports, docs pipelines, newsletter/HTML archives → ebook, SaaS backends that already have HTML and need files.
Try it: HTML sample → PDF + EPUB (run succeeded with PDF+EPUB).
Input
| Field | Required | Notes |
|---|---|---|
html_content | yes | Full HTML string (max ~3 MB UTF-8) |
title | no | EPUB metadata / cover (default Document) |
author | no | EPUB metadata (default Unknown) |
generate_pdf | no | default true |
generate_epub | no | default true |
pdf_page_format | no | A4 | Letter | Legal |
pdf_margins | no | e.g. {"top":"20mm","bottom":"20mm","left":"15mm","right":"15mm"} |
EPUB chapter splits need at least one <h2> in the body.
Example input (1:1 with Store Task html-sample-pdf-epub)
{"html_content": "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Sample Document</title></head><body><h1>Sample Document</h1><p>Apify Store QA sample used as input prefill.</p><h2>Chapter 1</h2><p>Short paragraph for PDF and EPUB conversion.</p><h2>Chapter 2</h2><p>Second chapter so EPUB splits on h2.</p></body></html>","title": "Sample HTML to PDF & EPUB","author": "Apify Store Example","generate_pdf": true,"generate_epub": true,"pdf_page_format": "A4","pdf_margins": {"top": "20mm","bottom": "20mm","left": "15mm","right": "15mm"}}
Output
Dataset row with title, generated_at, pdf_url, epub_url (when enabled). PDF/EPUB also stored in the run key-value store.
Pricing
Pay-per-event + platform usage. Set a maxTotalChargeUsd on the run if you want a hard spend cap — conversion is refused when the budget is exhausted.
Limits
html_content~3 MB max- Default memory 2048 MB (1024–4096)
- Typical timeout ~300s for normal docs
Who it's for
Developers and automations that already generate HTML and need PDF/EPUB without maintaining a browser farm.
Not for: scraping a live URL into HTML (pass the HTML string yourself), or complex print CSS edge cases beyond Chromium defaults.