HTML to PDF & EPUB Converter
Pricing
from $30.00 / 1,000 pdf/epub outputs
Go to Apify Store

HTML to PDF & EPUB Converter
Convert an HTML string into professional PDF (Playwright) and EPUB (ebooklib; chapters split on <h2>).
Pricing
from $30.00 / 1,000 pdf/epub outputs
Rating
0.0
(0)
Developer
Andres Sanabria
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
2 days ago
Last modified
Categories
Share
HTML to PDF and EPUB Converter
An Apify Actor that converts a raw HTML string (html_content) into:
- PDF via headless Playwright/Chromium (with page-break-friendly CSS)
- EPUB via BeautifulSoup + ebooklib (chapters split on
<h2>headings)
Input contract
Required:
html_content— full HTML string to convert
Optional:
title(default:Document)author(default:Unknown)generate_pdf/generate_epub(default:true)pdf_page_format(A4|Letter|Legal)pdf_margins— e.g.{"top":"20mm","bottom":"20mm","left":"15mm","right":"15mm"}
See input_example.json for a complete example. EPUB chapter splits require at least one <h2> in the HTML body.
Usage (Apify)
POST https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs?token=YOUR_TOKENContent-Type: application/json
Body: same shape as input_example.json.
Local Dev
python -m venv .venvsource .venv/bin/activate # Windows: .venv\Scripts\activatepip install -r requirements.txtplaywright install chromium# Smoke conversion (no Apify token required):python scripts/smoke_convert.py# Full Actor run (needs Apify CLI + token / local storage):apify run -i input_example.json
Artifacts from the smoke script land in test_output/.
Limits (P1)
html_contentmax size: ~3 MB (UTF-8). Larger inputs fail with a clear error.- Pay-per-event runs honor
ACTOR_MAX_TOTAL_CHARGE_USD/maxTotalChargeUsd: if the budget is exhausted (or set to 0), conversion is refused before PDF/EPUB work. - Default memory: 2048 MB (min 1024, max 4096). Prefer a Console/API run timeout around 300s for typical documents.