Solved

Update PDF Meta Data

Posted on 2014-01-20
2
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 54

Accepted Solution

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Invest in your employees with these five simple steps to improve employee engagement and retention.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

734 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