Solved

Update PDF Meta Data

Posted on 2014-01-20
2
558 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 53

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

838 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