mod fonts;
mod images;
mod render;
pub use fonts::FontRegistry;
pub use images::ImageEmbedError;
pub use lightweight_pdf_core::*;
pub use lightweight_pdf_fonts::FontError;
pub use lightweight_pdf_layout::{LayoutWarning, LayoutWarningKind};
pub use render::{DocumentExt, RenderError};
#[cfg(all(feature = "wasm-size-probe", not(feature = "default-fonts")))]
compile_error!(
"wasm-size-probe needs a font source: enable `default-fonts` alongside it (see plan/00a-contracts-and-artifacts.md, point 2)"
);
#[cfg(feature = "wasm-size-probe")]
#[no_mangle]
pub extern "C" fn lightweight_pdf_wasm_size_probe() -> i32 {
let mut doc = Document::new(PageFormat::A4);
doc.add(Text::new("Hallo Rechnung").size(18.0).bold());
let cell = |s: &str| Text::new(s).size(10.0);
doc.add(Row::new().gap(8.0).child(cell("Menge")).child(cell("Preis")));
doc.add(Line::new());
match doc.render() {
Ok(bytes) => i32::try_from(bytes.len()).unwrap_or(i32::MAX),
Err(_) => -1,
}
}