dotemacs / pdfboxing

Nice wrapper of PDFBox in Clojure
BSD 3-Clause "New" or "Revised" License
177 stars 38 forks source link

Save document only once on set-fields #64

Closed lucasdf closed 2 years ago

lucasdf commented 3 years ago

Description of your pull request

Change set-fields logic to save the document only once after all fields have been renamed. The current behavior calls .save after filling each field.

Why should it be considered?

The main motivation for this is to support using the function set-fields with a ByteArrayOutputStream.

The current logic calls .save after renaming each field, which appends the whole content of the PDF to the output stream, producing a bloated and potentially invalid PDF.

This is not a problem when passing a file since it just overwrites the file content each time, which works but seems inefficient.

Why am I asking this?

In order to support using this function to save the result to a ByteArray.

Pull request checklist

Thanks for maintaining this lib!

dotemacs commented 3 years ago

Thanks for the contribution @lucasdf!

I like it. I'll merge it soon.

Thanks again.

rafaeldelboni commented 2 years ago

@dotemacs any news on this? Do we need to do something else to get this merged? Also, it came to my attention that are still several open pull requests for a while, do you need any help evaluating them? :)

dotemacs commented 2 years ago

Hey @lucasdf

Thank you for doing this change. I've merged it to master and I've updated the changelog.

Also, thank you for the patience in waiting for me to merge it

/cc @rafaeldelboni