RavenRS · Rust GUI

PagedDocumentView

Edit and run the PagedDocumentView RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.

One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.

Rust source

fn paged_document_view() -> impl View {
    let sheet = ImageData::from_fn(120, 170, |x, y| {
        // Lines of a page, where a real app would hand over a rendered PDF.
        let line = y % 12 < 3 && (10..110).contains(&x) && (14..156).contains(&y);
        if line { Color::rgb(0.55, 0.55, 0.6) } else { Color::rgb(0.98, 0.98, 0.97) }
    });
    PagedDocumentView::new(
        48,
        |_| Size::new(420.0, 595.0),
        // Page 3 has not been drawn yet: it shows a placeholder of the right size.
        move |page| sheet.clone().filter(|_| page != 2),
    )
    .height(400.0)
}

The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.

More examples