HTML to PDF & EPUB Converter — Raw HTML String to Files avatar

HTML to PDF & EPUB Converter — Raw HTML String to Files

Pricing

from $30.00 / 1,000 pdf/epub outputs

Go to Apify Store
HTML to PDF & EPUB Converter — Raw HTML String to Files

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

Andres Sanabria

Maintained by Community

Actor 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

FieldRequiredNotes
html_contentyesFull HTML string (max ~3 MB UTF-8)
titlenoEPUB metadata / cover (default Document)
authornoEPUB metadata (default Unknown)
generate_pdfnodefault true
generate_epubnodefault true
pdf_page_formatnoA4 | Letter | Legal
pdf_marginsnoe.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.