wkhtmltopdf / wkhtmltopdf

Convert HTML to PDF using Webkit (QtWebKit)
https://wkhtmltopdf.org
GNU Lesser General Public License v3.0
13.94k stars 1.81k forks source link

How to add author, description for a pdf? #4197

Open karthick37 opened 5 years ago

karthick37 commented 5 years ago

Is it possible to define author, description, title and keywords for the pdf generated by wkhtmlpdf ?

https://i.stack.imgur.com/yMgiC.png

Thanks!

Light-Wizzard commented 4 years ago

You can use GhostScript, make a file name mydocinfo.pdfmark and add this to it

[ /Title (Title goes here)
  /Author (Autors Name here)
  /Subject (Subject goes here)
  /Keywords (Keywords here)
  /DOCINFO
pdfmark

then run is like this:

gs                     \
  -o with-metadata.pdf \
  -sDEVICE=pdfwrite    \
  existing.pdf         \
  mydocinfo.pdfmark

You can use other tools, I use this: perl-image-exiftool This will add the metadata, and make a backup of the original pdf.

exiftool -Title="Title goes here" -Author="Authors Name here" -Subject="Subject goes here" -Keywords+="Keywords here" fileName.pdf

Website