PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Nov 17, 2018 12:07 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Aug 13, 2007 9:20 am 
Offline

Joined: Mon Aug 13, 2007 9:01 am
Posts: 4
Location: Moscow
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 14, 2007 2:34 pm 
Offline

Joined: Mon Aug 13, 2007 9:01 am
Posts: 4
Location: Moscow
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 14, 2007 4:34 pm 
Offline

Joined: Mon Aug 13, 2007 9:01 am
Posts: 4
Location: Moscow
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 02, 2007 5:56 pm 
Offline
empira Employee
User avatar

Joined: Thu Oct 12, 2006 10:07 pm
Posts: 49
Location: Cologne, Germany
Youre are right.
I fixed this in PdfDictionary.PdfDictionaryElements.IDictionary.Add:
Code:
if (key is PdfName)
  key = (key as PdfName).Value;
[/code]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group