Expand description
§Overview
This crate is a simplified port of Python’s pdf2image
that wraps pdftoppm
and pdftocairo
(part of poppler)
to convert PDFs to image::DynamicImage
s.
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::{PDF2ImageError, RenderOptionsBuilder, PDF};
fn main() -> Result<(), PDF2ImageError> {
let pdf = PDF::from_file("examples/pdfs/ropes.pdf").unwrap();
let pages = pdf.render(
pdf2image::Pages::Range(1..=8),
RenderOptionsBuilder::default().build()?,
);
println!("{:?}", pages.unwrap().len());
Ok(())
}
Re-exports§
pub use image;
Structs§
- Crop
- Crop a specific section of the page
- A PDF file
- Render
Options - Options for rendering PDFs
- Render
Options Builder - Builder for
RenderOptions
.
Enums§
- DPI
- Specifies resolution in terms of dots per inch
- PDF2
Image Error - pdf2img error variants
- Pages
- Specifies which pages to render
- Password
- Password to unlock encrypted PDFs
- Scale
- Scales pages to a certain number of pixels
Type Aliases§
- Result
- A
Result
type alias usingPDF2ImgError
instances as the error variant.