Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Update PDF Meta Data

Posted on 2014-01-20
2
Medium Priority
?
595 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 56

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I originally wrote this article to compare SARDU and YUMI, but have now added Easy2Boot, since that is the one I currently use and find the easiest to create and alter.
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

916 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