Add and retrieve custom properties from PDF

Q: I’m trying to determine if the SDK will allow us to read custom properties in the PDF file such as below. I did not see anything directly in the API, but I may be missing something.

A:

Yes you can add and retrieve custom properties like this. Adobe is adding these custom properties to the “Info” dictionary, along with “Title”, “Author”, etc. Hence why there is the warning at the bottom of the dialog.

The following python code demonstrates how to find a custom document property.

keysToIgnore = {“Title”:True, “Author”:True, “Subject”:True,

“Keywords”:True, “Creator”:True, “Producer”:True,

“CreationDate”:True, “ModDate”:True, “Trapped”:True}

doc = PDFDoc(inputpath);

doc.InitSecurityHandler()

info = doc.GetTrailer().FindObj(“Info”)

if info:

itr = info.GetDictIterator()

while itr.HasNext():

key = itr.Key().GetName()

value = itr.Value()

if key not in keysToIgnore:

print(key + " : " + value.GetAsPDFText())

itr.Next()

Also, see this forum posting on how to add your own custom property using PDFNet.

http://groups.google.com/group/pdfnet-sdk/browse_thread/thread/d3a45c65a950234b/236622767b862eb1?lnk=gst&q=get+info+obj#236622767b862eb1