fschutt / printpdf

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

Reusing SVG on few pages. Is it possible to make Svg cloneable? #115

Open beling opened 2 years ago

beling commented 2 years ago

I try to reuse the same SVG object on few pages. But I cannot find any better solution than just parse the same SVG file for each page. I found that all fields of Svg struct are clonable. Maybe it is save to just make Svg cloneable too?

BTW. Thank You for your great work on printpdf!

fschutt commented 2 years ago

Right now the SVG is stored on the pages /Resources dictionary, but you'd need it to be stored on the document (so that it is visible to multiple pages).

beling commented 2 years ago

Thank You. Is it possible to store SVG on the document in the current printpdf version?

fschutt commented 2 years ago

Currently no. Right now only per-page resources are allowed, I think I have to rework the API regarding that anyways.