1mod fonts;
6mod images;
7mod render;
8
9pub use fonts::FontRegistry;
10pub use images::ImageEmbedError;
11pub use lightweight_pdf_core::*;
12pub use lightweight_pdf_fonts::FontError;
13pub use lightweight_pdf_layout::{LayoutWarning, LayoutWarningKind};
14pub use render::{DocumentExt, RenderError};
15
16#[cfg(all(feature = "wasm-size-probe", not(feature = "default-fonts")))]
17compile_error!(
18 "wasm-size-probe needs a font source: enable `default-fonts` alongside it (see plan/00a-contracts-and-artifacts.md, point 2)"
19);
20
21#[cfg(feature = "wasm-size-probe")]
26#[no_mangle]
27pub extern "C" fn lightweight_pdf_wasm_size_probe() -> i32 {
28 let mut doc = Document::new(PageFormat::A4).margin(Margin::symmetric(20.0, 18.0));
29 doc.add(Text::new("Hallo Rechnung").size(18.0).bold());
30 doc.add(
31 Row::new()
32 .gap(8.0)
33 .child(Text::new("Menge").size(10.0))
34 .child(Text::new("Preis").size(10.0)),
35 );
36 doc.add(Line::new());
37 match doc.render() {
38 Ok(bytes) => bytes.len() as i32,
39 Err(_) => -1,
40 }
41}