View previous topic :: View next topic |
Author |
Message |
BoresXP
Joined: 13 Aug 2007 Posts: 4 Location: Moscow
|
Posted: 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 |
|
Back to top |
|
|
BoresXP
Joined: 13 Aug 2007 Posts: 4 Location: Moscow
|
Posted: 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. |
|
Back to top |
|
|
BoresXP
Joined: 13 Aug 2007 Posts: 4 Location: Moscow
|
Posted: 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! |
|
Back to top |
|
|
Stefan Lange
Joined: 12 Oct 2006 Posts: 47 Location: Cologne, Germany
|
Posted: 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)
key = (key as PdfName).Value; | [/code] |
|
Back to top |
|
|
|