fschutt / printpdf

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

svg: improve bbox handling of generated PDF #112

Closed cyphar closed 2 years ago

cyphar commented 2 years ago

Some SVGs have fractional pixel bounding boxes, which we can safely round up without the user noticing anything. In addition, previously this code would use the width (x2) as both the height and width of the bounding-box -- this is also rectified.

This is a rebase and re-application of commit d79c8a28764d ("svg: improve bbox handling of generated PDF") which was accidentally reverted by commit 80bf42ed74ad ("Reapply: "svg: implement std Error for SvgParseError").

Signed-off-by: Aleksa Sarai cyphar@cyphar.com

cyphar commented 2 years ago

This is a rebase of #110. As I mentioned in #110, the way you reapplied #107 ended up reverting this patch.

cyphar commented 2 years ago

Oh and the impl std::error::Error is also gone so #107 also is missing code. I'll add it to this PR.