PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Document null, cant read

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
wadeholm



Joined: 12 Oct 2007
Posts: 3
Location: Johannesburg Southafrica

PostPosted: Fri Oct 12, 2007 6:26 am    Post subject: Document null, cant read Reply with quote

I get the following error and i am trying to read a few pdf files to merge them.
This is my read statement: PdfDocument inputDocument = PdfReader.Open(filename1, PdfDocumentOpenMode.ReadOnly);

and it throws this exception at : Debug.Assert(kid.Elements.GetName(Keys.Type) == "/Pages");
PdfPage.InheritValues(kid, ref values);
ArrayList list = new ArrayList();
PdfArray kids = kid.Elements["/Kids"] as PdfArray;
foreach (PdfReference xref2 in kids)

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="PdfSharp"
StackTrace:
at PdfSharp.Pdf.PdfPages.GetKids(PdfReference iref, InheritedValues values, PdfDictionary parent) in C:\Documents and Settings\Wade\My Documents\Work\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfPages.cs:line 359
at PdfSharp.Pdf.PdfPages.FlattenPageTree() in C:\Documents and Settings\Wade\My Documents\Work\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfPages.cs:line 315
at PdfSharp.Pdf.Advanced.PdfCatalog.get_Pages() in C:\Documents and Settings\Wade\My Documents\Work\PDFsharp\PdfSharp\PdfSharp.Pdf.Advanced\PdfCatalog.cs:line 102
at PdfSharp.Pdf.PdfDocument.get_Pages() in C:\Documents and Settings\Wade\My Documents\Work\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfDocument.cs:line 590
at PdfSharp.Pdf.PdfDocument.get_PageCount() in C:\Documents and Settings\Wade\My Documents\Work\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfDocument.cs:line 480
at Pdf_Merge.Form1..ctor() in C:\Documents and Settings\Wade\My Documents\Work\Projects\Pdf Merge\Pdf Merge\Form1.cs:line 67
at Pdf_Merge.Program.Main() in C:\Documents and Settings\Wade\My Documents\Work\Projects\Pdf Merge\Pdf Merge\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Please Please help. could it be that there is a problem with my PDF file even though it opens fine in acrobat 8.
Thank you very much.
Wade Crying or Very sad
Back to top
View user's profile Send private message
wadeholm



Joined: 12 Oct 2007
Posts: 3
Location: Johannesburg Southafrica

PostPosted: Fri Oct 12, 2007 6:35 am    Post subject: Reply with quote

Oh and i have also tried to use this code to get my pdf file: PdfDocument inputDocument = PdfReader.Open(filename1, PdfDocumentOpenMode.Import);
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Oct 15, 2007 8:48 am    Post subject: Re: Document null, cant read Reply with quote

wadeholm wrote:
Please Please help. could it be that there is a problem with my PDF file even though it opens fine in acrobat 8.

This could be the case - we'd need the PDF file to have a closer look.
I presume your PDF file is untypical - maybe a special case PDFsharp is not prepared for, maybe a buggy PDF file.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
wadeholm



Joined: 12 Oct 2007
Posts: 3
Location: Johannesburg Southafrica

PostPosted: Mon Oct 15, 2007 9:52 am    Post subject: Reply with quote

Can i just send it to your email or how do i go about doing that
Thank you
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Thu Nov 15, 2007 4:20 pm    Post subject: Reply with quote

Hi!

I was able to replicate the problem.
It'll work with this change (File PdfPages.cs, around Line 358):

Code:
        PdfArray kids = kid.Elements["/Kids"] as PdfArray;
        //newTHHO 15.10.2007 begin
        if (kids == null)
        {
          PdfReference xref3 = kid.Elements["/Kids"] as PdfReference;
          kids = xref3.Value as PdfArray;
        }
        //newTHHO 15.10.2007 end
        foreach (PdfReference xref2 in kids)
          list.AddRange(GetKids(xref2, values, kid));


There are 5 new lines.

The fix will be included with the next release of PDFsharp.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com