PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Exception when opening PDF file https://forum.pdfsharp.net/viewtopic.php?f=3&t=212 |
Page 1 of 1 |
Author: | BoresXP [ Mon Aug 13, 2007 9:20 am ] |
Post subject: | Exception when opening PDF file |
When I try to open a file (I can send you this file by mail) System.AgrumentException is thrown: "key must be of type System.String". When I'm opening the same file in PDFSharp Document Explorer I see the same error. Stack trace: in PdfSharp.Pdf.PdfDictionary.DictionaryElements.System.Collections.IDictionary.Add(Object key, Object value) in PdfSharp\\PdfSharp.Pdf\\PdfDictionary.cs:line 1043 in PdfSharp.Pdf.PdfDictionary.DictionaryElements.Add(Object key, PdfItem value) in PdfSharp\\PdfSharp.Pdf\\PdfDictionary.cs:line 1062 in PdfSharp.Pdf.PdfPage.InheritValues(PdfDictionary page, InheritedValues values) in PdfSharp\\PdfSharp.Pdf\\PdfPage.cs:line 515 in PdfSharp.Pdf.PdfPages.GetKids(PdfReference iref, InheritedValues values, PdfDictionary parent) in PdfSharp\\PdfSharp.Pdf\\PdfPages.cs:line 350 in PdfSharp.Pdf.PdfPages.GetKids(PdfReference iref, InheritedValues values, PdfDictionary parent) in PdfSharp\\PdfSharp.Pdf\\PdfPages.cs:line 360 in PdfSharp.Pdf.PdfPages.FlattenPageTree() in PdfSharp\\PdfSharp.Pdf\\PdfPages.cs:line 315 in PdfSharp.Pdf.Advanced.PdfCatalog.get_Pages() in PdfSharp\\PdfSharp.Pdf.Advanced\\PdfCatalog.cs:line 102 in PdfSharp.Pdf.PdfDocument.get_Pages() in PdfSharp\\PdfSharp.Pdf\\PdfDocument.cs:line 590 |
Author: | BoresXP [ Tue Aug 14, 2007 2:34 pm ] |
Post subject: | |
Exception is rised in PdfSharp.Pdf.PdfDictionary.DictionaryElements, in IDictionary.Add implementation. key parameter is checked to be a string, but it is of type PdfSharp.Pdf.PdfName. This code is called from DpfSharp.Pdf.PdfPage.InheritValues. |
Author: | BoresXP [ Tue Aug 14, 2007 4:34 pm ] |
Post subject: | |
OK, I found where the error is: File: PdfPage.cs Line: 515 Is: Code: resources.Elements.Add(name, item); Must be: Code: resources.Elements.Add(name.Value, item);
Please, correct this error! |
Author: | Stefan Lange [ Sun Sep 02, 2007 5:56 pm ] |
Post subject: | |
Youre are right. I fixed this in PdfDictionary.PdfDictionaryElements.IDictionary.Add: Code: if (key is PdfName) [/code]
key = (key as PdfName).Value; |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |