Pages

Wednesday, June 20, 2012

Changing the info for a pdf-file

Usually when creating a pdf-file I do it from Libreoffice. But sometimes I need to scan some pages and create a pdf-file from that. On those occasions the title showing up in the pdf-viewers title bar is either blank or is being filled by the scanner software.
I like my pdfs to look more professional so I change the Title value and usually also the Author value.

Changing theese values are very easy as long as I use pdftk. I also use pdftk for merging pdf-files, sdding stamps or watermarks to documents. Pdftk can also be used to add a password for a file and a lot more. Check out pdflabs for more info about pdftk.

But for changing the Author and Title for your pdf-file this is a quick and easy way of doing it:

Create a simple text-file like info.txt:

InfoKey: Title
InfoValue: LinuxProject
InfoKey: Author
InfoValue: W. Author
InfoKey: Subject
InfoValue: This is a edited pdf-file

As you can clearly see the format of this file is simply made up of the key-value -part. Every InfoKey get its InfoValue.

To insert this metadata into your pdf-file you can simply run this command:


pdftk infile.pdf update_info info.txt output outfile.pdf 


The result of this is that your outfile.pdf now will have your chosen metadata displayed in the pdf-reader window, and properties sheet.

No comments:

Post a Comment