Crate pdf2image_alt

source ·
Expand description

§Overview

This crate is a modified version of https://github.com/styrowolf/pdf2image with some changes that make it easier and cheaper to render single pages

It requires poppler to be installed on your system. You can follow the instructions found in the README.md file which is most easily viewed on github.

§Quick Start

use pdf2image_alt::{PDF2ImageError, RenderOptionsBuilder, PdfInfo, render_pdf_multi_page};

fn main() -> Result<(), PDF2ImageError> {
    let data = std::fs::read("examples/pdfs/ropes.pdf").unwrap();
    let pdf_info = PdfInfo::try_from(data.as_slice()).unwrap();
    let options = RenderOptionsBuilder::default().pdftocairo(true).build()?;
    let pages = render_pdf_multi_page(&data, &pdf_info, pdf2image_alt::Pages::Range(1..=8), &options);

    Ok(())
}

Re-exports§

Structs§

Enums§

  • Specifies resolution in terms of dots per inch
  • pdf2img error variants
  • Specifies which pages to render
  • Password to unlock encrypted PDFs
  • Scales pages to a certain number of pixels

Functions§

Type Aliases§

  • A Result type alias using PDF2ImgError instances as the error variant.