boazsegev/combine_pdf

Enable setting all document information dictionary entries

conorom opened this issue · 1 comments

In one of my projects we've been using CombinePDF for some time to add watermarks to PDFs prior to download.
Thanks for maintaining this very useful gem!

Recently we decided to edit the Keywords info dict entry at the same time, but CombinePDF doesn't allow this out of the box.
I found it was easy to add a line to this area in a class_eval to set the Keywords value.

Is there a reason why all of the information dictionary entries shouldn't be added there?

Thanks again for your time.

+1
I might try to take a stab at a pull request for this as I'm facing a similar issue.
Super grateful for all the work that's gone into this library.
My specific case is that I'm merging some PDFs and want to preserve the CreationDate of the original PDF.

But right now, this field gets explicitly deleted after parsing, and then it's also set explicitly to match the modification date when saving.

I'd like to:

  • remove the line that deletes the creation date if it exists when parsing a PDF
  • remove the line that sets the creation data to Time.now if a creation date already exists
  • as @conorom suggests above, allow the caller to override any of these metadata fields (Title, Subject, Keywords, Author, CreationDate, ModDate, Creator, Producer) via the options hash.

If I manage to get a pull request created for this, I'll update.

Thanks again!