fschutt / printpdf

An easy-to-use library for writing PDF in Rust
https://docs.rs/printpdf/
MIT License
777 stars 95 forks source link

Get PDF as Vec<u8> #101

Closed Flocksserver closed 2 years ago

Flocksserver commented 2 years ago

Hi, thanks for your work. It would be really great to have a simple API to get the pdf as Vec<u8>. Something like:

let (doc, _, _) = PdfDocument::new("Test", Mm(247.0), Mm(210.0), "Layer 1");
let buf: Vec<u8> = doc.finish();

This is what I would need for my use case.

Cheers, Marcel

Flocksserver commented 2 years ago

thanks a lot! I mean, it was also possible before, but it felt very hacky, especially when the rest of the lib api is so clean and easy to use 🙏