HTML → PDF
Converting a novel from HTML to PDF: what each format is, what gets lost, the pitfalls for long fiction, and the right tools.
What is HTML?
HTML / XHTML is the structural language of the web and is literally the content format inside an EPUB; .mhtml (MHTML) packs a page together with all its resources (images, CSS) into one file, which is what "save as a single page" produces. XML is the general markup language that formats such as FB2 and OPF are themselves written in. The whole family is tagged text where the tags carry the structure, so how much structure survives a conversion depends on how well the tool understands them.
.html.htm.xhtml.xml.mhtmlWhat is PDF?
PDF is Adobe's fixed-layout document format. It records what to draw at which coordinate on a page rather than which paragraph a sentence belongs to. The layout is therefore identical everywhere, which suits contracts, papers and scans. The cost is that PDF is inherently hostile to reflow: line breaks are usually visual, extracted text often carries hard returns and scrambled column order, and scanned PDFs contain images only, with no text layer at all.
.pdfWhat to watch out for when converting HTML to PDF
Extracting from the source
All structure lives in the tags, but real pages mix in navigation, ads and footers that a naive conversion carries along. Extract the content container first (a readability pass), and note that <img> usually points outside the file — images must be downloaded and embedded before producing a single-file format.
Writing the target format
Producing PDF freezes the content: once generated it cannot reflow, so readers cannot change font size or line width and long text is painful on small screens. For extended reading PDF is usually the wrong target — it suits printing, archiving and layout-critical delivery.
Where the two formats interact
- Reflow is lost: the target freezes the layout, so readers can no longer change font size or line width. Long novels become zoom-and-pan on small screens — the most common reason a conversion ends up harder to read. Unless you need print or layout-critical delivery, keep a reflowable copy for reading.
What gets lost
- Adjustable font size and screen-based reflow
- CSS presentation: fonts, sizes, colours, indents and spacing
- Text reflow (a generated PDF is fixed for good)
What you gain
- Identical layout everywhere, ideal for printing
Post-conversion checklist
- Convert the first three chapters as a trial and check for lost text, interleaved lines or misplaced blocks before doing the whole book.
- Check chapter splitting: the TOC entry count should match the real chapter count.
- Jump to five random spots and search a character name to confirm the text is fully searchable.
- Confirm illustration count and placement — check that images are not all dumped at the end of a chapter.
- Fill in title, author and language — a wrong language tag breaks typesetting such as Chinese line breaking.
- Check margins and that the Chinese font is embedded, otherwise it renders as boxes on another machine.
Converting novels: what is different
Fiction is the most common and the most peculiar kind of e-book: hundreds or thousands of chapters, almost no figures, often nothing but a TXT source, and Chinese sources that frequently carry anti-piracy garbling. These are the points that bite hardest.
- The target has no notion of a table of contents, and not being able to jump to a chapter is the worst part of reading something long. If you will keep reading it, keep a navigable copy as well (EPUB or Kindle) and treat this one as the distribution or archive copy.
- Once a long novel is in a fixed layout, reading on a phone means zooming and panning. Fiction is the worst fit for fixed layout of any genre: almost no figures, all continuous text. Unless you are printing or submitting it, prefer a reflowable format for novels.
- Volume markers ("Volume One", "Volume Two") usually degrade to ordinary headings, losing the volume/chapter hierarchy. If that matters, promote volume headings one level in an editor afterwards so they are not siblings of chapter titles.
Tools for converting HTML to PDF
Any of the tools below can handle this direction; pick one by your operating system and how many files you have. Read the previous section first — doing the steps out of order (converting a scanned file before running OCR, for instance) usually means starting over.
ocrmypdf / Tesseract
FreeCommand lineAn open-source way to add a text layer (OCR) to scanned PDFs, with Chinese support. Scanned files must go through this before any text-extraction conversion, otherwise the output is blank. Expect to proofread the recognised characters.
Stirling PDF
FreeOnline serviceAn open-source PDF toolbox that splits, merges, rotates, compresses and extracts text in the browser, and can be self-hosted so files never leave your network. Good for the PDF side; for reflowable output Calibre remains the better choice.
Calibre
FreeDesktop appThe de-facto standard for e-book conversion, free and open source. It converts EPUB, MOBI, AZW3, PDF, TXT, FB2, DOCX, HTML and nearly everything else, generating tables of contents, fetching metadata and batch-processing whole libraries. The interface is utilitarian, PDF output is mediocre, and the option set takes time to learn.
Common questions
What is lost when converting HTML to PDF?
Adjustable font size and screen-based reflow; CSS presentation: fonts, sizes, colours, indents and spacing; Text reflow (a generated PDF is fixed for good).
Which tool should I use to convert HTML to PDF?
Recommended: ocrmypdf / Tesseract, Stirling PDF, Calibre. ocrmypdf / Tesseract fits this pair best. An open-source way to add a text layer (OCR) to scanned PDFs, with Chinese support. Scanned files must go through this before any text-extraction conversion, otherwise the output is blank. Expect to proofread the recognised characters.
What should I watch out for when converting HTML to PDF?
Reflow is lost: the target freezes the layout, so readers can no longer change font size or line width. Long novels become zoom-and-pan on small screens — the most common reason a conversion ends up harder to read. Unless you need print or layout-critical delivery, keep a reflowable copy for reading.
Converted it — now what do you read it with?
Tide Reader opens TXT and EPUB, detects chapters on import, lays the text out the way you like it, and syncs your reading position across Windows, macOS, iOS and Android. Drop the converted file in and start reading.
Download Tide ReaderTXT and EPUB; local-first reading, with optional cloud sync and WebDAV.
