PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Aug 07, 2020 3:01 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Unhandled Exception
PostPosted: Sat Sep 22, 2007 9:41 pm 

Joined: Sat Sep 22, 2007 9:32 pm
Posts: 1
Hello All. I am integrating your software in a project to add a watermark to a PDF document. Unfortunately I am not competent in C#. I get an exception (shown below) when I open *some* PDF Files. That is some PDFs are fine, others make the exception. Kind regard and a fine job on this project.

The code from the Watermark sample which causes the problem is here:

PdfDocument document = PdfReader.Open(filename);

The Error Output:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at PdfSharp.Pdf.PdfPages.GetKids(PdfReference iref, InheritedValues values, P
dfDictionary parent) in C:\Projects\PDF Tools\PDFSharp-1.0.898\PDFsha
rp\PdfSharp\PdfSharp.Pdf\PdfPages.cs:line 359
at PdfSharp.Pdf.PdfPages.FlattenPageTree() in C:\Projects\PDF Tool
s\PDFSharp-1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfPages.cs:line 315
at PdfSharp.Pdf.Advanced.PdfCatalog.get_Pages() in C:\Projects\PDF
ne 102
at PdfSharp.Pdf.PdfDocument.get_Pages() in C:\Projects\PDF Tools\P
DFSharp-1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf\PdfDocument.cs:line 590
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocument
OpenMode openmode, PdfPasswordProvider passwordProvider) in C:\Projects\PDF Tools\PDFSharp-1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:lin
e 388
at PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOp
enMode openmode, PdfPasswordProvider provider) in C:\Projects\PDF Too
ls\PDFSharp-1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:line 200
at PdfSharp.Pdf.IO.PdfReader.Open(String path) in C:\Projects\PDF
Tools\PDFSharp-1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:line 216
at Watermark.Program.Main(String[] args) in C:\Projects\PDF Tools\
PDFSharp-1.0.898\PDFsharp\Samples C#\Watermark\Program.cs:line 81

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group