Skip to main content

jubarte_render/
lib.rs

1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! # jubarte-render
6//!
7//! The render product of the jubarte engine: `convert::docx_to_pdf` and
8//! friends lay a Word document out page by page and write a PDF (or PNG
9//! pages) with Word-faithful layout - the fidelity benchmarks measure the
10//! `word` revision style against Microsoft Word's own Save as PDF. The
11//! pure option types (`PdfOptions`, `RevisionStyle`, …) live in
12//! jubarte-opc's `render_options` and are re-exported here at their
13//! historical `convert::` paths.
14//!
15//! # Example
16//!
17//! ```rust,no_run
18//! use jubarte_render::convert::{PdfOptions, RevisionStyle, docx_to_pdf, docx_to_pdf_with, docx_to_png};
19//!
20//! fn main() -> Result<(), Box<dyn std::error::Error>> {
21//!     let docx = std::fs::read("redline.docx")?;
22//!
23//!     // Default options: tracked changes in the conventional colours.
24//!     std::fs::write("redline.pdf", docx_to_pdf(&docx)?)?;
25//!
26//!     // Tracked changes drawn the way Microsoft Word prints them.
27//!     let word = PdfOptions { revisions: RevisionStyle::Word, ..PdfOptions::default() };
28//!     std::fs::write("redline-word.pdf", docx_to_pdf_with(&docx, word)?)?;
29//!
30//!     // One PNG per page, at 96 dpi.
31//!     for (n, png) in docx_to_png(&docx, PdfOptions::default(), 96.0)?.iter().enumerate() {
32//!         std::fs::write(format!("page-{}.png", n + 1), png)?;
33//!     }
34//!     Ok(())
35//! }
36//! ```
37
38#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
39#![forbid(unsafe_code)]
40#![warn(missing_docs)]
41
42// A5 shims: the floors' modules under the names the moved code uses, so
43// `crate::<module>::…` paths compile unchanged.
44pub use jubarte_dom::{namespaces, util, xmllinq};
45pub use jubarte_opc::{admission, opc};
46pub(crate) use jubarte_opc::{
47    markup_simplifier, numbering, render_options, strict_translation, table_dom,
48};
49
50/// DOCX to PDF and PNG, with Word-faithful layout.
51pub mod convert;