I'm using Wicked PDF to generate a PDF from HTML. I've seen this SO question on adding metadata to a PDF, and it suggests using XMP metadata. How can I use Wicked PDF to add XMP metadata to a generated PDF?
Asked
Active
Viewed 1,131 times
4
-
did u find an answer for this? – Santino 'Sonny' Corleone Jun 23 '14 at 04:06
-
I think that since this gem is just a wrapper for command line program `wkhtmltopdf`, and this program does not support adding metadata, you are out of luck. Maybe someone will come up with a "patcher" that lets you add metadata after Wicked has written the page, but this would be ugly. Note that `prawn` writes metadata, but this is not useful since you're starting with HTML. – Gene Jun 26 '14 at 17:14
-
@Gene yes,i did it using prawn...with wicked-pdf i can add the title to the pdf using the html `
` tag,but meta tags `` dont work – Santino 'Sonny' Corleone Jun 27 '14 at 04:48 -
I'm also pretty sure the final answer is that Wicked PDF just doesn't support it, and you should use something else (like Prawn, as @Gene suggested). – Waynn Lue Jun 29 '14 at 17:39
2 Answers
0
If you are creating the original document using Prawn as you say, then just use the info
attribute to set the meta-data you need. See the manual and search for :info
. I'm not sure what you mean when you say Wicked PDF adds a title. PDF documents don't have titles (although sections and subsections can in the outline). See this discussion, for example.
-
1PDF documents don't have titles? Unless you count the 'Title' entry in the Document Information Dictionary. Which Adobe Reader lists under Document Properties. – Spike0xff Jan 09 '15 at 18:51
0
If you can't add metadata directly with WickedPDF, you might try using another library to add the metadata after the PDF is generated (a two step process).
I found an SO answer that suggests PDFtk might be able to do that: https://stackoverflow.com/a/18536830/473691.

Community
- 1
- 1

James Mason
- 4,246
- 1
- 21
- 26