J-F-Liu / lopdf

A Rust library for PDF document manipulation.
MIT License
1.67k stars 177 forks source link

[FEATURE] `get_page_annotations_mut` #332

Open jeertmans opened 2 months ago

jeertmans commented 2 months ago

Hello,

I wrote a small CLI that merges page annotations, and I had to implement a get_page_annotations_mut function to this end, as this is not featured in your crate.

Would it make sense to you to include such a feature? If so, I'd be happy to make a PR :-)

My implementation: https://github.com/jeertmans/rpdf/blob/9b2a4086d8482b2d7e74c973d556abbdf3d2cc68/src/cli/annotations.rs#L153-L185 (note that the unwrap logic dates back to before <0.34)

janriemer commented 1 month ago

Oh, this is really neat, thank you! I'm currently writing a crate on top of lopdf that can attach arbitrary files to pages of pdfs and for this I also need mutable access to the annotations.

Until this is not implemented in lopdf: @jeertmans can I use your code (of course with proper attribution) in my crate (licensed under MIT/APACHE 2.0)? If yes, under which license does it fall? Thank you! :slightly_smiling_face:

jeertmans commented 1 month ago

Hi @janriemer, my code is under the MIT licence, which is quite permissive so you can just steal it and adapt it as you want, but I appreciate any mention :)

Heinenen commented 1 week ago

I don't think the API of lopdf follows any coherent strategy, so adding another function shouldn't be a problem.