PDF to PNG or JPG possible? - Newbie Question

Hello,

i tried Rust a few days ago and i find it really awesome. :smile:
I would like to know if it is possible to build a little programm that can convert PDF Files to PNG or JPG.
I searched google and this forum but didn't found an answer. I looked arround at https://crates.io
It seems that printpdf can convert to images but only in bpm.

Once you get raw image data (e.g. Vec<u8> of RGB(A)), it should be fairly easy to use different crates to work with different formats.

PDF is a complex monster, and conversion to a raster format requires supporting all of that complexity. I don't think there's a Rust crate for this yet. There are only a handful libraries in the world that can do that.

printpdf can't create an image from a PDF. It can create a PDF with an image embedded — that's the other direction.

1 Like

PDF is fun. No, not really.

I am coauthor of

It works on most files, for rasterizing, you would have to use raqote or figure out how to get the off-screen renderer in pathfinder to work.

3 Likes