This page gives a helpful example of how to set custom document properties for a pdf.
So I've done this (and I've verified that the custom property is set in the file):
Doc theDoc = new Doc();
int theID = theDoc.AddObject("<< >>");
theDoc.SetInfo(-1, "/Info:Ref", theID.ToString());
theDoc.SetInfo(theID, "/Company:Text", "ACME");
theDoc.Save(FileName);
I'm trying to retrieve the property at a later time. I've tried:
Doc theDoc = new Doc();
theDoc.Read(FileName);
int theID = theDoc.AddObject("<< >>");
theDoc.SetInfo(-1, "/Info:Ref", theID.ToString());
return theDoc.GetInfo(theID, "/Company:Text"); //returns empty string
and
//...read theDoc
int theID = theDoc.GetInfoInt(-1, "/Info");
return theDoc.GetInfo(theID, "/Company:Text"); //returns empty string
Anybody have a clue as to how I can retrieve that property?
I found another way to set these values:
if (theDoc.GetInfo(-1, "/Info") == "")
theDoc.SetInfo(-1, "/Info:Ref", theDoc.AddObject("<< >>").ToString());
theDoc.SetInfo(-1, "/Info*/Company:Text", "ACME");
After setting the values in this way, I'm able to retrieve them like so:
if (theDoc.GetInfo(-1, "/Info") == "")
theDoc.SetInfo(-1, "/Info:Ref", theDoc.AddObject("<< >>").ToString());
string companyName = theDoc.GetInfo(-1, "/Info*/Company:Text");