spindrift 0.1.0

A HTML/CSS to PDF renderer, targeting spec compliance and efficiency
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Minimal asynchronous HTML-to-PDF rendering example.

use std::fs::File;

use spindrift::{Html, PdfOptions, RenderOptions};

#[tokio::main]
async fn main() -> spindrift::Result<()> {
    let mut output = File::create("output/spindrift-basic.pdf")?;
    Html::from_string("<title>Basic</title><p>Hello, world</p>")
        .write_pdf(
            &mut output,
            &RenderOptions::default(),
            &PdfOptions::default(),
        )
        .await
}