Skip to content

Renderer

Converts the Document model into HTML.

docwow.renderer.html_renderer.render_document(doc, embed_images=True, page_view=False)

Render a Document to a complete, self-contained HTML string.

Parameters:

Name Type Description Default
doc Document

The document model to render.

required
embed_images bool

When True (default), images are embedded as base64 data URIs. When False, a placeholder src is used (useful for testing without large base64 blobs).

True
page_view bool

When True, adds CSS that styles the document as a physical page (gray background, drop shadow) and injects an @media print block with @page size/margin rules so the browser paginates correctly when printing or exporting to PDF.

False

Returns:

Type Description
str

A UTF-8 HTML string starting with <!DOCTYPE html>.

docwow.renderer.css_generator.generate_css(doc, page_view=False)

Return a complete CSS string (without the