I was requesting the creation date for the PDF via the document info and it threw an exception about casting from PdfStringObject to a PdfNameObject. I looked at the source code and was able to locate the problem.
PdfDictionary.cs - Line 677:
Code:
string date;
if (obj is PdfString)
date = ((PdfString)obj).Value;
else if (obj is PdfStringObject)
date = ((PdfNameObject)obj).Value;
else
throw new InvalidCastException("GetName: Object is not a name.");
Notice in the else if you check for PdfStringObject then attempt to cast to PdfNameObject as opposed to PdfStringObject. It should really be:
Code:
string date;
if (obj is PdfString)
date = ((PdfString)obj).Value;
else if (obj is PdfStringObject)
date = ((PdfStringObject)obj).Value;
else
throw new InvalidCastException("GetName: Object is not a name.");
Hope that helps!