Solutions

Generate PDF thumbnails at scale.

Convert first pages or any pages to JPEG/PNG thumbnails. Batch process document libraries without a display server.

Code example

rust
use pdfluent::{Sdk, ThumbnailOptions, ImageFormat};

fn main() -> pdfluent::Result<()> {
    let sdk = Sdk::new()?;
    let doc = sdk.open("report.pdf")?;

    let opts = ThumbnailOptions::builder()
        .width(320)
        .format(ImageFormat::Jpeg)
        .quality(85)
        .build();

    // Render the first page as a thumbnail
    let thumb = doc.thumbnail(0, opts)?;
    thumb.save("preview.jpg")?;

    println!("Thumbnail: {}x{}", thumb.width(), thumb.height());
    Ok(())
}

Run cargo add pdfluent@1.0.0-beta.5 to get started.

What it does

Configurable output size

Set the target width in pixels. PDFluent calculates the height to preserve the page aspect ratio. Or set both width and height explicitly and choose a fit or crop mode.

Multi-format output

Output as JPEG, PNG, or WebP. JPEG with quality 75-85 is the typical choice for document previews. PNG is available for transparent backgrounds. WebP gives smaller files at comparable quality.

First-page and custom-page thumbnails

Pass page index 0 for a cover thumbnail. Pass any valid page index to generate previews for interior pages. Page indices are zero-based.

Headless rendering

No display server, no X11, no GPU driver required. The renderer is purely software-based. It runs on Alpine Linux containers and AWS Lambda without any extra system packages.

Batch processing with parallelism

Use Rayon to process a folder of PDFs across all CPU cores. Each document opens, renders its thumbnail, and saves independently. Throughput scales linearly with core count up to I/O limits.

WASM thumbnail generation

The thumbnail API is part of the WASM build. Generate document previews entirely in the browser. No file upload needed. Typical thumbnail generation for a single page takes under 200 ms in Chrome on a modern laptop.

Deployment options

Server-side (Linux/macOS/Windows)AWS LambdaDockerCloudflare Workers (WASM)Browser (WASM)

Frequently asked questions