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).margin(Margin::symmetric(20.0, 18.0));
doc.add(Text::new("Hallo Rechnung").size(18.0).bold());
doc.add(
Row::new()
.gap(8.0)
.child(Text::new("Menge").size(10.0))
.child(Text::new("Preis").size(10.0)),
);
doc.add(Line::new());
match doc.render() {
Ok(bytes) => bytes.len() as i32,
Err(_) => -1,
}
}