Skip to content

Long e-books to PDF: rhwp time limit follows the text, calibre PDF route - #131

Merged
KnifeLemon merged 1 commit into
mainfrom
fix/large-ebook-pdf
Oct 19, 2026
Merged

KnifeLemon merged 1 commit into
mainfrom
fix/large-ebook-pdf

Conversation

@KnifeLemon

Copy link
Copy Markdown
Owner

Fixes #127.

Long e-books (400+ pages) to PDF went EPUB β†’ HWPX (built in) β†’ PDF (rhwp) and failed after rhwp's fixed 2-minute limit, while rhwp was still rendering. Ranking calibre first didn't help: calibre had no e-book β†’ PDF edge.

rhwp time limit follows the document

  • rhwp renders text slowly. On an i7-1185G7 with rhwp 0.8.7 it takes about 1 s per KB of section XML, some 4 s per page of a novel, so a 640-page book takes ~48 min. export-hwpx and convert take seconds.
  • Every rhwp run now gets 2 min + 30 min per MB of unpacked Contents/section*.xml, capped at 60 min, so a hung rhwp is still stopped. An HWP counts 3Γ— its file size, since its text is deflated. Pictures don't raise the limit.
  • The progress estimate scales the same way (15 min per MB) instead of reaching 90 % after a few seconds.
  • Cancelling still stops rhwp immediately.
  • A time-out fails with error.rhwp_timeout. When calibre is installed, error.rhwp_timeout_calibre suggests moving Calibre above the HWPX writer in Settings β†’ Engines for e-books. Filee never switches engines by itself.
  • LibreOffice (3 min), Ghostscript (5), Pandoc (2) and calibre (10) keep their fixed limits. calibre made the same 640-page PDF in about a minute.

calibre as an e-book β†’ PDF engine

  • New calibre edges: EPUB, MOBI, AZW3, AZW, PRC, FB2, HTMLZ, TXTZ and the formats only calibre reads β†’ PDF, run with --paper-size a4 --pdf-page-numbers.
  • Cost 23: with the default engine order the built-in route (31) still wins by one, so results don't change. Once calibre is ranked above the HWPX writer, calibre wins (≀ 31 vs β‰₯ 32).
  • LIT, LRF and the other calibre-only formats β†’ PDF now take one calibre run instead of calibre β†’ EPUB β†’ HWPX writer β†’ rhwp.
  • Engine description (en/ko/zh-CN) and docs/ENGINES.md are updated.

Tests

  • Route test: the default order and calibre just below the HWPX writer keep HWPX writer β†’ rhwp. Calibre above it, or first, gives a single calibre step (also EPUB β†’ PNG through calibre β†’ PDFium). DOCX is unaffected.
  • calibre ranked first: EPUB β†’ PDF end to end (A4, calibre producer, Korean text). Skips without calibre.
  • rhwp text size and time limit values.
  • Core 246, Cli 22, App 320, Engines 985 passed. The one Engines failure was a LibreOffice heap crash while the App tests ran at the same time; that test passes 6/6 on its own.

πŸ€– Generated with Claude Code

…ute (#127)

rhwp's export-pdf had a fixed 2-minute limit, so a 400+ page EPUB β†’ HWPX β†’ PDF
failed while rhwp was still working. rhwp renders about 1 s per KB of section
XML (some 4 s per page of a novel on an i7-1185G7), so every rhwp run now gets
2 min + 30 min per MB of unpacked Contents/section*.xml (an HWP counts three
times its size), at most 60 min. The progress estimate scales the same way.
A time-out fails with its own message, which suggests ranking calibre above
the HWPX writer for e-books when calibre is installed.

calibre now makes PDFs of EPUB, MOBI, AZW3, AZW, PRC, FB2, HTMLZ, TXTZ and the
formats only it reads (A4, page numbers). The edges cost 23: the built-in
route stays the default, and calibre wins once it is ranked above the HWPX
writer in Settings β†’ Engines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon
KnifeLemon merged commit 0de23b0 into main Oct 19, 2026
9 checks passed
@KnifeLemon
KnifeLemon deleted the fix/large-ebook-pdf branch October 19, 2026 12:55
@KnifeLemon KnifeLemon added the bug Something isn't working label Oct 20, 2026
@KnifeLemon KnifeLemon self-assigned this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EPUB β†’ PDF conversion of large e-books times out at 95% β€” rhwp export-pdf killed by hard 120 s limit

1 participant