These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Reading metadata with javascript

mtscout6
Registered: Apr 29 2008
Posts: 2

I noticed some postings on Adobe Javascript that is used to read metadata as well as edit it. However, it was unclear on how to utlize that in javascript. I am looking to setup a web page that indexes all the pdf files in a folder. I would like to read the metadata for each file to provide a brief description of the document. Ho can I do that?

Thanks,
mtscout6

My Product Information:
Reader 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Acrobat JavaScript can read and edit metadata in a PDF when that PDF is open in Acrobat, since Acrobat JavaScript operates from inside Acrobat.

The Acrobat javaScript environment can not be easily accessed from an external JS environment, like a web browser. Here's a link to a web page that demonstrates sending messages from JS on an HTML page to JS in a PDF that's loaded into a web browser.

http://www.windjack.com/WindJack/Browser2PDF/brwsr2acroJS.htm

However, I don't think this is the best way get the functionality you want. You'd be better off using a server side tool to extract the metadata from the PDF files, which I assume are in folder on the server. Do a google search on "PDF Server Tool" and "PDF library". This should yield a long list of free and not so free tools you could use on your server. For example, there is an open souce PDF Library called iText.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script