In line 585 of PdfCopy.cs, the following line can throw exception: return CopyStream((PRStream)inp);
Sometimes, the type of inp can be PdfStream, which can not be cast to PRStream and will throw InvalidCastException. Please change the line to: return inp is PdfStream ? inp : CopyStream((PRStream)inp);
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php