#jpeg #pdf

bin+lib jpeg-to-pdf

Create PDFs from JPEG images

5 releases

0.2.3 Aug 10, 2021
0.2.2 Feb 24, 2021
0.2.1 Feb 21, 2021
0.2.0 Feb 19, 2021
0.1.1 Jan 31, 2021

#9 in #jpg

MIT/Apache

165KB
406 lines

A crate for creating PDFs from JPEG images.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Creates PDFs from JPEG images.

Images are embedded directly in the PDF, without any re-encoding.

Example

use std::fs::{self, File};
use std::io::BufWriter;

use jpeg_to_pdf::JpegToPdf;

let out_file = File::create("out.pdf").unwrap();

JpegToPdf::new()
    .add_image(fs::read("one.jpg").unwrap())
    .add_image(fs::read("two.jpg").unwrap())
    .add_image(fs::read("three.jpg").unwrap())
    .create_pdf(&mut BufWriter::new(out_file))
    .unwrap();

Dependencies

~23MB
~204K SLoC