Hi
outPdf.Keywords = "foo, bar";
apparently does not have the same effect as setting this property through the Acrobat GUI. The keywords field of a PDF generated with the above code in DynamicPDF will display (in Acrobat, not Reader) as
"foo, bar";
(with quotes and semicolon). If I manually remove the extraneous quotes and semicolon and now look at the PDF source, I see that it's XMP section contains
<pdf:Keywords>foo, bar</pdf:Keywords>
and
<rdf:Bag>
<rdf:li>foo</rdf:li>
<rdf:li>bar</rdf:li>
</rdf:Bag>
both of which I did not get in the generated PDF and which look like the desired behaviour.
Regards,
Nicolas
Setting Keywords Field
Re: Setting Keywords Field
Support · May 31, 2006Hello Nicolas,
I was able to recreate the behavior that you mentioned below (at least somewhat). I was finding that the quotes were appearing (in the keywords section of the document properties) but not the semicolon for me. Either way however I would suspect that this is not the designed behavior. I will talk with one of the developers here to find out what is the exact intended behavior here.
I will post another message as soon as I hear one way or the other on this.
Thanks,
ceTe Software Support Team
Re: Setting Keywords Field
Support · Jun 1, 2006Hi Nicolas,
I looked into this a bit more and here is what I have found. First, when setting the Document's "Keyword" property in DynamicPDF the XMP section is not automatically created, but rather the keywords are added to the PDF's information dictionary. This is done for efficiency and reduction of file size as the XMP data is not always needed.
As for the fact that the Keywords are visibly displayed in the Acrobat (Professional version 7.0 is what I am using) under the document properties with quotes around them is just the way that Acrobat chooses to display these keywords. In other words, if you create a simple PDF document with the keywords as you did above, you will notice if you view the PDF code of the output document that the Keywords value in the PDF's information dictionary looks like this:
"/Keywords(foo, bar)"
And since by default there is no XMP, the above is the place where Acrobat is pulling the keywords from. As you can see there are no quotations or semicolons associated with the keywords and therefore anything that is displayed in the document property "Keyword" section is added by Acrobat and not our product.
Now with that said, as you have noticed if the keywords are added to the XMP of the PDF then there are no quotes or anything additional displayed with the "Keywords" property when viewed from Acrobat. When you open up the PDF in Acrobat and add or modify any of the Keywords Acrobat adds the XMP section with the keywords to the document automatically. The document then contains the Keywords in the information dictionary, as mentioned above, and in the XMP section, as you mentioned in your original post. When the Keywords appear in both places like this, by default, Acrobat pulls the keywords from the XMP section, thus not displaying any quotes or colons.
Now the question then becomes, why does Acrobat place quotes (and in your case a semicolon) with the keywords when it pulls them from the information dictionary of the document but it does not do this when pulling the keywords from the XMP section of the document? And the answer to this question we do not know (only Adobe would know).
But while we do not know the reason that Acrobat behaves this way, we can work within the confines of it. In other words, if you want (or are okay with) Acrobat adding the quote characters to the Keywords then you can just add the keywords directly to the PDF without using the XMP, like in your original post:
outPdf.Keywords = "foo, bar";
But if you prefer that Acrobat not add extra data to the Keywords section of the properties of the PDF then you will need to make sure the Keywords are added to the XMP section of the document using something like this:
outPdf.Keywords = "foo, bar";
outPdf.XmpMetadata = new ceTe.DynamicPDF.Xmp.XmpMetadata();
This will create the XMP section along with the keywords and will then show up as expected when viewed from Acrobat.
If you have any questions about any of this or would like more clarification on any of these points just let us know.
Thanks,
ceTe Software Support Team
Re: Setting Keywords Field
Forum member · Jun 1, 2006Thank you for the thorough investigation. Generating the XMP solves the problem perfectly.
Regards,
Nicolas