PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
PDFDictionary - PdfDocumentInfo.CreationDate exception https://forum.pdfsharp.net/viewtopic.php?f=3&t=1451 |
Page 1 of 1 |
Author: | richerm [ Wed Dec 01, 2010 4:40 pm ] |
Post subject: | PDFDictionary - PdfDocumentInfo.CreationDate exception |
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! |
Author: | Thomas Hoevel [ Wed Dec 01, 2010 4:53 pm ] |
Post subject: | Re: PDFDictionary - PdfDocumentInfo.CreationDate exception |
Thank you for the feedback. It's fixed with current internal builds and future public builds. |
Author: | jeffhare [ Thu Jan 20, 2011 4:04 pm ] |
Post subject: | Re: PDFDictionary - PdfDocumentInfo.CreationDate exception |
Hi Thomas, Any chance of making the "current internal build" available even if it's not official? -Jeff |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |