Spindrift PDF

Jump to a language:

Terminal • Rust • Python

Terminal (bash or zsh)

First, install spindrift:

cargo install spindrift-cli

Now, convert HTML pages to PDFs:

spindrift source.html document.pdf

Read more: Official documentation on Docs.rs

Rust

To get started in Rust, add Spindrift to your project:

cargo add spindrift

Then, you can integrate spindrift into your codebase:

use spindrift::{Html, PdfOptions, RenderOptions};
use std::fs::File;

let mut output = File::create("document.pdf")?;
Html::from_file("document.html")
    .await?
    .write_pdf(
        &mut output,
        &RenderOptions::default(),
        &PdfOptions::default(),
    )
    .await?;

Read more: Official documentation on Docs.rs • crates.io

Python

Read more: TODO