How does browser ODT parsing convert OpenDocument XML?
Browser conversion extracts the ZIP container in memory and walks content.xml and styles.xml inside a dedicated Web Worker. A custom ordered XML tree keeps text nodes and nested inline elements interleaved exactly as authored before handing paragraphs, lists, tables, and embedded images to the local FlowDoc PDF engine.
Mixed-content XML parsing and inline run ordering
Standard object-map XML parsers drop or reorder sibling text when styled spans sit inside sentences such as <text:p>A <text:span>B</text:span> C</text:p>. Our parseOrderedXml parser stores child nodes as a flat ordered sequence of text and element tokens conforming to the OASIS OpenDocument Format v1.3 Part 3 Schema, preserving exact reading order.
- Space runs: Expands
<text:s>elements according to thetext:crepeat count, defaulting to at least one space when omitted. - Tab stops: Translates
<text:tab>separators into four inline spaces during text run collection so column alignment stays readable. - Line breaks: Converts
<text:line-break>nodes into explicit soft newline breaks inside the active paragraph block. - Hyperlinks: Renders
<text:a>anchor elements with underlined blue styling while keeping surrounding sentence spacing intact.
Package guards for encrypted files, Calc, and Impress
Before parsing any document body, the worker validates the mimetype stream and META-INF/manifest.xml inside the unpacked archive. Files carrying opendocument.spreadsheet (.ods) or opendocument.presentation (.odp) headers stop immediately with format-specific messages instead of failing later with cryptic XML errors.
If META-INF/manifest.xml includes encryption-data, the converter stops and advises removing the password in LibreOffice Writer before saving again. Archives missing content.xml or <office:text> report the missing structure clearly; for Windows print-spool containers, you can convert Windows XPS print files to PDF using the dedicated fixed-page reader.
Supported ODT styles, tables, lists, and embedded images
LibreOffice Writer, OpenOffice, and Collabora store shared paragraph definitions in styles.xml and automatic per-edit overrides inside content.xml. Both office:styles and office:automatic-styles are merged into one lookup map before walking <office:text> and <text:section> containers.
| ODT XML element | Extracted attributes & children | FlowDoc PDF output behavior |
|---|---|---|
<text:h> |
text:outline-level (1 to 6), text:style-name |
Scaled bold heading, keepNext, PDF bookmark outline |
<text:p> and <text:span> |
fo:font-weight, fo:font-style, fo:color, fo:background-color |
Inline styled runs in exact document sequence |
<text:list> |
Nested <text:list-item> and child <text:list> |
Depth 0 bullets, nested numeric markers, 18 pt indent steps |
table:table |
table:table-header-rows, table:number-columns-spanned |
Shaded header cells, equal column widths, full grid borders |
<draw:frame> |
<draw:image xlink:href>, svg:width, svg:height |
Embedded PNG or JPEG image clamped to 24 pt minimum |
Resolving paragraph inheritance, headings, and lists
Style lookup walks style:parent-style-name chains up to depth 8 so child automatic styles inherit bold weights, italics, underlines, background shading, text alignment, and spacing from parent templates. Heading levels 1 through 6 map to 20, 16, 13.5, 12, 11.5, and 11 pt defaults unless overridden, while populating PDF outline bookmarks under Library of Congress PDF 1.7 Standard (ISO 32000-1) conventions.
Nested <text:list> blocks indent progressively by (listDepth + 1) * 18 pt so multi-level outlines stay visually distinct. Depth zero items render solid bullet markers, whereas deeper nested levels automatically number items sequentially (1., 2., 3.) across sibling entries.
Tables with spanning cells and Pictures folder artwork
Table conversion inspects table:table-column declarations alongside table:table-header-rows and body table:table-row entries inside each table:table block under ISO 26300 XML layout rules. Header rows receive subtle [0.94, 0.96, 0.98] shading, column spans read table:number-columns-spanned, and equal-width grid columns divide available content width 100% cleanly with full cell borders.
Image extraction walks <draw:frame> containers to resolve xlink:href targets inside Pictures/ and embeds binary streams directly into PDF pages. If your team receives Microsoft Office .docx manuscripts alongside .odt drafts, use browser-based Word DOCX to PDF conversion to render OpenXML documents under the same local FlowDoc engine.
Controlling ODT page layout, margins, and LibreOffice parity
Different printers and regional teams standardize on either ISO A4 or North American Letter stock. Choosing the right Page size option before clicking Convert ODT to PDF prevents unexpected wrapping changes or wide margin gaps when sharing deliverables across regions.
Auto layout detection vs A4 and US Letter presets
In Auto (from ODT page layout) mode, parseLengthPt converts fo:page-width, fo:page-height, and four margin attributes from cm, mm, in, pc, px, or pt into 72 pt-per-inch PDF coordinates. When styles.xml lacks style:page-layout-properties, Auto falls back to standard A4 (595.28 by 841.89 pt) with 56 pt margins on all sides.
Selecting A4 (210 × 297 mm) overrides document page dimensions with standard A4 geometry, while US Letter (8.5 × 11 in) sets a 612 by 792 pt box. Paragraphs carrying fo:break-before="page" trigger explicit page breaks; teams authoring developer documentation in plain text can also compile technical Markdown specifications ready for archival printing with consistent page geometry.
Tip: Click Load sample ODT (
project-atlas-brief.odt) to inspect headings, inline teal italics, bullets, and a shaded status table before converting complex multi-page reports.
Font mapping and standard Latin character fallbacks
Font family hints in style:font-name and fo:font-family map automatically onto PDF mono, serif, or sans metrics so code snippets, formal reports, and UI guides keep distinct typography. Characters outside the standard Latin PDF glyph set are counted in replacedChars and flagged below the completion card whenever "?" substitutions occur.
Image streams inside Pictures/ detect PNG files via 0x89 0x50 header bytes conforming to the W3C PNG Third Edition Specification and JPEG artwork via 0xFF 0xD8 markers. Frames omitting svg:width or svg:height default to 360 by 220 pt, while tiny icons clamp to at least 24 by 24 pt and unsupported binary formats increment skippedImages.
Private client-side conversion and downstream workflows
Every ZIP extraction, XML traversal, style cascade, and PDF page build runs inside a Comlink Web Worker on your machine. Unlike server-side office converters that upload contracts, HR letters, or manuscripts to remote LibreOffice queues, zero bytes leave your browser tab. Clicking Cancel during rendering or Change file afterward clears the active state right away.
All OpenDocument archives follow the container layout defined in OASIS OpenDocument Format v1.3 Part 2 Packages, where an uncompressed mimetype entry precedes META-INF/manifest.xml and content.xml. Because odtToPdf reads XML streams, scales px frame lengths at 96 DPI, and unpacks Pictures/ binaries in memory, archives over 5 MB convert offline once loaded.
After conversion completes, ResultPanel surfaces byte savings, elapsed processing time, the generated .pdf download, and direct shortcuts to Compress PDF, Merge PDFs, and Add watermark. No remote queue or third-party cloud storage ever holds your exported document. Teams turning recorded project meetings into LibreOffice notes before generating final PDF handouts can also clean raw captions first with Transcript Cleaner.