Bcbury
Bcbury

Reputation: 117

ItextSharp PDFCopy throwing null reference exception

I'm attempting to merge 2 pdfs, (I'm following the examples in the iText in Action 2nd edition book) and I'm getting a null reference exception error when attempting to run this code:

MemoryStream stream = new MemoryStream();
document = new Document();
PdfCopy copy = new PdfCopy(document, stream);
document.Open();                                     //breakpoint here

The copy object has a null reference exception every time. I've been unable to find a simple answer to this anywhere else on this site. Thanks in advance!

Upvotes: 3

Views: 2324

Answers (1)

Exulted
Exulted

Reputation: 373

According to this question, you have to ignore this exception. I am getting the same exception in iTextSharp 5.5.2. By simply ignoring it, I am able to proceed in my code and copy pages into a new pdf file alright.

Upvotes: 2

Related Questions