Skip to main content

render_html_fixed

Function render_html_fixed 

Source
pub fn render_html_fixed(
    geometry: &PageGeometry,
    pages: &[Page],
    images: &[ImageResource],
    extras: &DocExtras,
) -> Result<String, HtmlError>
Expand description

Serialize typeset pages to a single, self-contained HTML document, using generic system-font fallback (Slice 1/2 behavior, unchanged): no @font-face block, every run styled by the plain .run CSS class. This is the base-14 twin of rustyfi_pdf::render_pdf_with — pass render_html_fixed_ttf_with a real TtfFontStore instead when the document was typeset against real embedded fonts, for metric-faithful output (Slice 3, see this module’s doc comment).

Argument-for-argument with rustyfi_pdf::render_pdf_with (lib.rs:459): geometry (reads only paper_width/paper_height, exactly like the PDF writer), pages (the post-page-break Vec<PlacedLine> per Page), images (the document-wide image table — Image boxes resolve their ImageId against it, Slice 3), and extras (Slice 4: page_graphics is now rendered as a per-page <svg> underlay, see render_html_impl; annotations/outline/doc_info remain a documented gap — there is no HTML analogue of a PDF /Annots//Outlines tree in this Option-A serializer).

One <div class="page"> per Page, sized to paper_width/paper_height in CSS pt (1:1 with SATySFi’s own point unit). Inside, every PureHorzBox::InnerString run on a PlacedLine becomes one absolutely-positioned <span> at its resolved (x, y) — SATySFi’s page coordinates are already y-down from the paper top (PlacedLine’s own doc comment, pagebreak.rs:13), which is exactly CSS’s top convention, so unlike the PDF writer this needs no y-flip.