Welcome Guest Search | Active Topics | Sign In | Register

ArgumentNullException in PdfDocument Split or Clone function Options
Jochen
Posted: Wednesday, December 5, 2012 6:55:38 AM
Rank: Newbie
Groups: Member

Joined: 6/21/2012
Posts: 5
Hi,

I try to split one PDF document into several pieces using the following piece of code

Code: C#
PdfDocument doc = new PdfDocument(@"d:\Test.pdf");
            foreach (PdfBookmark bm in doc.Bookmarks)
            {
                PdfDocument doc2 = doc.Clone(bm.Destination.Page.Index, 1);
            }

The first two pages are cloned succesfull, but on page index 2 i get a ArgumentNullException with the message "Value cannot be null. Parameter name: key"
The same exception occurs when I try to use the Split function.

I will send the PDF file that will trigger the exception to support email right after posting this message.

Here is the stack trace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at EO.Pdf.Internal.ai.c(a A_0)
at EO.Pdf.PdfDocument.<>c__DisplayClass2.<Clone>b__0(ld obj)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.w.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ea.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.w.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ah.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ea.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ah.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ea.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ah.a(ag A_0)
at EO.Pdf.Internal.ag.b(ld A_0)
at EO.Pdf.Internal.ag.a(IEnumerable`1 A_0)
at EO.Pdf.Internal.ag.a(hi A_0)
at EO.Pdf.PdfDocument.Clone(Int32 fromPage, Int32 pageCount)
... my code


Thanks a lot for looking into the problem.
Jochen
eo_support
Posted: Wednesday, December 5, 2012 5:11:35 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

We have posted a new build that should fix this problem and have emailed you the download link. Please let us know if the new build works for you.

Thanks!
Jochen
Posted: Wednesday, December 5, 2012 8:28:19 PM
Rank: Newbie
Groups: Member

Joined: 6/21/2012
Posts: 5
Hi,

Yes, the new build fixes the problem.
Thank you very much for your super fast support!

However I think there is another problem regarding the file size when using the Clone or Split function. The resulting file size is okay on extracted page 1 using Clone, but grows up consistantly until the last page is extracted.
File sizes using the Split function are extraordinary large (up to 1MB per extracted page / input file is 60 KB)

Best regards,
Jochen
eo_support
Posted: Thursday, December 6, 2012 10:23:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

I believe this is caused by the license message. Every time you try to clone a license message is added to the file. So they keep going up. As soon as you apply your license the file size should no longer increase.

Thanks
Jochen
Posted: Friday, December 7, 2012 4:10:44 AM
Rank: Newbie
Groups: Member

Joined: 6/21/2012
Posts: 5
Hi,

You are right.
Actually I do have a license, but just had not set it up in my test project.
With the license set, file sizes will no longer increase.

Thanks for clearing it up and for your great support! I appreciate it.
Jochen


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.