pdf2image/lib.rs
1//! # Overview
2//! This crate is a simplified port of Python's [`pdf2image`](https://github.com/Belval/pdf2image/) that wraps `pdftoppm` and `pdftocairo` (part of [poppler](https://poppler.freedesktop.org/))
3//! to convert PDFs to `image::DynamicImage`s.
4//!
5//! 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
6//! github](https://github.com/styrowolf/pdf2image/blob/main/README.md).
7//!
8//! ## Quick Start
9//!
10//! ```rust
11//! use pdf2image::{PDF2ImageError, RenderOptionsBuilder, PDF};
12//!
13//! fn main() -> Result<(), PDF2ImageError> {
14//! let pdf = PDF::from_file("examples/pdfs/ropes.pdf").unwrap();
15//! let pages = pdf.render(
16//! pdf2image::Pages::Range(1..=8),
17//! RenderOptionsBuilder::default().build()?,
18//! );
19//! println!("{:?}", pages.unwrap().len());
20//!
21//! Ok(())
22//! }
23//! ```
24mod error;
25mod pdf;
26mod render_options;
27mod utils;
28
29pub use error::{PDF2ImageError, Result};
30pub use pdf::{Pages, PDF};
31pub use render_options::{Crop, Password, RenderOptions, RenderOptionsBuilder, Scale, DPI};
32
33// re-export image crate
34pub use image;