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

Document properties - keywords field - scripts add double quotes for multiple values

teslarian
Registered: Jan 21 2011
Posts: 2
Answered

I was wondering if you could clear something up for me... it's about inserting multiple keywords as separate values while batching using scripts or javascript.. no matter the tool or method, multiple keywords get inserted surrounded by double quotes thereby rendering them useless as separate keywords... Using Acrobat javascript, I can't seem to get a handle on them because they are not seen as a part of the string's value...???? Can anyone help or point us to some documentation that can?

My Product Information:
Acrobat Pro
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
The Keywords, in the info (description) section of the PDF document, are maintained somewhat differently from the other info properties, such as the title and author. All of the other properties are single strings, where as the keywords are a list of strings. All this info is part of the PDF XMP Metadata. In Acrobat, open up the document properties dialog, select the Description Tab. Enter some Keywords separated by commas. To see how this data is organized internally click on the "Additional Metadata" button, select the "Advanced" panel. This shows the complete PDF XMP metadata as it is stored inside the PDF. Expand the "XMP Core Properties" section and you'll see how the keywords are stored in Acrobat.

The JavaScript "doc.info.keywords" property is good for getting the keywords, but it does not properly set the keywords. To do this you have to modify the XMP metadata directly. Look in the JavaScript reference at the "doc.metadata" property. There's an example of how to use the E4X XML parser to modify the metadata. Unfortunately is does not show how to modify the keywords. But fortunately E4X is extremely easy to use. You can look up E4X examples at the Mozilla site.

I did write an automation tool that does show exactly how to modify the keywords. It's available to members at www.pdfscripting.com


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

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
I have also noticed this behavior when inserting keywords through a PS file and then distilling the PS file into a PDF file.

George Kaiser

teslarian
Registered: Jan 21 2011
Posts: 2
Thom,

Thanks a million for clearing that up! Would be very interested in taking a look at your automation tool for setting keywords...can you send us a link to it?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You'll find it listed here: Automation Tools at pdfscripting.comBut, as I mentioned earlier, these tools are only available to members.

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