Hi,
Trying to merge PDF documents together and then save the result to a memory stream. The code works for the majority of documents but for one particular document it throws the exception:
'Found invalid data while decoding'.
Tried upgrading to a more recent version of the .dll, which throws a different exception:
'Block length does not match with its complement'.
I'll email you the 2 test PDFs shortly.
Test code:
Code: C#
string fname1 = @"C:\Test1.pdf";
string fname2 = @"C:\Test2.pdf"; // The document that causes the issue
PdfDocument.Merge(fname1, fname2);
PdfDocument doc = new PdfDocument(fname1);
using (MemoryStream ms = new MemoryStream())
{
doc.Save(ms); // Exception here
// ... REST OF MY CODE
}
Stack trace:
at System.IO.Compression.Inflater.DecodeUncompressedBlock(Boolean& end_of_block)
at System.IO.Compression.Inflater.Decode()
at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length)
at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
at EO.Pdf.Internal.jw.a(Byte[] A_0)
at EO.Pdf.Internal.jw.b(Byte[] A_0, Stream A_1, ah A_2, Int32 A_3)
at EO.Pdf.Internal.h3.b(Byte[] A_0, String A_1, ah A_2, Int32 A_3)
at EO.Pdf.Internal.h3.d()
at EO.Pdf.Internal.d3.b()
at EO.Pdf.Contents.PdfContentContainer.k()
at EO.Pdf.StructTreeRoot.SyncWithPageContent(PdfPage page)
at EO.Pdf.PdfDocument.a()
at EO.Pdf.PdfDocument.Save(Stream stream)
Thanks for the help!
MJH