Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Adding PDF Metadata issue using PE


Adding PDF Metadata issue using PE

Has anyone ever had an issue inserting a# symbol into PDF Metadata attributes? I am using PE 5.3 M060 to generate my PDF's (but I get the same issue all the way back to 5.1). For some reason the pound sign gets added twice to the PDF Metadata properties when it is included in the string that I want to add. For example if the string is "Test # Test" and this should be placed in the keywords field within the PDF I am getting "Test ## Test" which is causing issues with my search results. I have tried many other symbols and they all seem to work fine including registered and copyright symbols. I am at a loss for what I can do to get this to work. Any suggestions are welcome.

Here is a snippet of code that adds the PDF Metadata (not sure if it will be any help or not):

Document doc = Application.openDocument(xformDocPath);

ADocument aDoc = (ADocument)doc;

Element elem = doc.getDocumentElement();

Node firstChild = elem.getFirstChild();

try {Element newElement = doc.createElementNS("", "atidmd:DocumentMetaData");

newElement.setAttribute("source", "atend");newElement.setAttribute(

"bookmarks", "auto"); elem.insertBefore((Node) newElement, firstChild);

Element newMetadataElement = doc.createElementNS("", "atidmd:DocumentMetaData"); elem.appendChild((Node)newMetadataElement);

Element newDocinfoElement = doc.createElementNS("", "atidmd:DocInfo"); newMetadataElement.appendChild((Node)newDocinfoElement);

Element newEntryElement = doc.createElementNS("", "atidmd:Entry"); newDocinfoElement.appendChild((Node)newEntryElement);

Element newKeyElement = doc.createElementNS("", "atidmd:Key");Element newValueElement = doc.createElementNS("", "atidmd:Value"); newEntryElement.appendChild((Node)newKeyElement);


Text key = doc.createTextNode("Keywords"); newKeyElement.appendChild(key);

Text value = doc.createTextNode(keywords);



catch (Exception ex) {

log("Error: " + ex.getMessage().toString(), w);resp.setOutputPage("Failed to add atidmd:DocumentMetaData Element to document. PDF Metadata attributes will not be added."); };


Thanks in advance,

Steve Barzousky


Just in case anyone else has this same issue I had to forward this to PTC support and it turns out that using the # symbol results in two ## symbols in the resulting PDF metadata. This has been logged as a bug and they are trying to determine a workaround for this.