Solved

Update PDF Meta Data

Posted on 2014-01-20
2
551 Views
Last Modified: 2014-01-24
I have a few hundred PDF's that I want to place the file name into the Title Meta Data.

Is there anything I can use to auto update rather than opening updateing and saving each file?
0
Comment
Question by:jdr0606
2 Comments
 
LVL 52

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39795332
The PDF Toolkit (PDFtk), an excellent (free!) product that I've been using for many years, can do this. It comes in both command line and GUI versions. The command line version is called PDFtk Server and may be downloaded here:
http://www.pdflabs.com/tools/pdftk-server/

Don't be misled by "Server" in the name. I don't know why they called it that, but it's just an executable (pdftk.exe, with a supporting DLL, libiconv2.dll) that runs on XP, Vista, W7, and W8 (it does not have to run on a "server" OS...it also runs on Mac, but I've never used it on that).

The manual for it is here:
http://www.pdflabs.com/docs/pdftk-man-page/

You want to look at the "dump_data" option, which reports on the metadata fields, and then the "update_info" option, which changes the metadata fields. Here's an example of what the "dump_data" file looks like (trimmed a little) from a PDF posted at a public site:

InfoBegin
InfoKey: Author
InfoValue: SE:W:CAR:MP
InfoBegin
InfoKey: Producer
InfoValue: Adobe LiveCycle Designer ES 9.0
InfoBegin
InfoKey: Creator
InfoValue: Adobe LiveCycle Designer ES 9.0
InfoBegin
InfoKey: Keywords
InfoValue: Fillable
InfoBegin
InfoKey: ModDate
InfoValue: D:20131129152708-05'00'
InfoBegin
InfoKey: Accessibility
InfoValue: structured; tagged
InfoBegin
InfoKey: Form fields
InfoValue: fillable
InfoBegin
InfoKey: Title
InfoValue: 2013 Form 1040
InfoBegin
InfoKey: Subject
InfoValue: U.S. Individual Income Tax Return
InfoBegin
InfoKey: CreationDate
InfoValue: D:20131129152618-05'00'
PdfID0: defb5d400969464b86df15a6db48b551
PdfID1: 7b051e02238abdf258b624ae7615f61e
NumberOfPages: 2

It sounds as if your interest is in the Title field, or perhaps you mean the Subject field. For both cases, the relevant lines for you are these:

InfoBegin
InfoKey: Title
InfoValue: this is the new title for your file
InfoBegin
InfoKey: Subject
InfoValue: this is the new subject for your file

Simply put those lines (3 or 6, depending on what you want to change) in a text file called, for example, <newtitle.txt> and execute this command:

pdftk oldfile.pdf update_info newtitle.txt output newfile.pdf

This assumes that your input/old/source file is <oldfile.pdf> and your output/new/destination file is <newfile.pdf>. The file names may, of course, be whatever you want, and they may be fully qualified with drives/paths.

If you want to see PDFtk used in a real-world app, including a call with the "dump_data" option, see this EE article:
http://www.experts-exchange.com/Software/Misc/A_11211-How-To-Split-Rename-Move-a-Batch-of-PDF-Files-Based-on-Contents-of-the-Files.html

It is a long article and program, but you may focus just on the usage of PDFtk. The tool has worked perfectly in all programs I've written that call it. Regards, Joe
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 39797310
If you have Adobe Acrobat Pro, you can use an Action to do that. To create an action that puts the filename into the Title document property, you would do the following:

Select Tools>Action Wizard>Create New Action

On the next dialog, expand the "More Tools" category and double-click on "Execute JavaScript" (or select it and click on the arrow button in the middle of the dialog to move it to the right side).

Now click on "Specify setting" under "Execute JavaScript" on the right side of the dialog. This will bring up the JavaScript editor. Here you would use the following script:

this.info.Title = this.documentFileName; 

Open in new window


Now expand the "Save & Export" category on the left side and bring the "Save" function over to the right. Open up the settings and modify them according to your needs (e.g. save under the same filename, add a prefix or a suffix, ...

You can run the action on e.g. all files in a certain directory and update them all at once.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PCAnywhere 2 122
How can I convert HTML files to .pdf files? 9 57
EDI Solution or comparable? 2 39
Moving files from folder to folder 8 30
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question