Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Can't Update / Add MetaData to PDF that uses Template #417

Closed
txt8888 opened this Issue · 5 comments

4 participants

@txt8888

When new a PDF based on a template, none of the :info = { ... } will be applied to the PDF file.

pdf = Prawn::Document.new(:template => "sample.pdf",
:info => {
:Title => "Sample METADATA",
:Author => "Me",
:Subject => "Not Working",
:CreationDate => Time.now,
})

@jonsgreen
Collaborator

Currently Prawn is deferring to the template for info and ignoring anything passed in.

It would not be difficult and seems appropriate to at least merge the info option from Document#new.

Can anyone think of a reason why we would not want to do this?

@bradediger
Collaborator

@jonsgreen I think that we should merge in any :info that was explicitly provided to Document.new. I'm not convinced that we should always override the metadata, for example setting Creator to "Prawn".

@txt8888

Thanks for the comment. Looking forward to the change.

@jonsgreen jonsgreen referenced this issue from a commit in jonsgreen/prawn
@jonsgreen jonsgreen Resolves Issue #417: Can't Update / Add MetaData to PDF that uses Tem…
…plate

- merge info metadata when creating with template
a4d15f5
@jonsgreen
Collaborator

@bradediger: I have submitted a pull request for this issue.

I think that if we do not want people to be overriding Prawn as Creator then we should make that a separate issue since we currently are allowing that for all documents when we call #normalize_metadata.

@bradediger
Collaborator

Oh, sorry, I definitely didn't mean to imply that we should prevent people from overriding Prawn as Creator. I was confused and thought the merge would have been happening the other way (merging in the template's information on top of the Prawn document's, which sounds like it is actually the previous behavior).

Your pull request looks good, and I merged it.

@practicingruby practicingruby removed the stale label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.