|
Rank: Newbie Groups: Member
Joined: 5/4/2012 Posts: 4
|
I'm trying to merge 4 pdf documents and getting the following error:
EO.Pdf.Internal.n: Header checksum illegal
stack: at EO.Pdf.Internal.kc.c(Byte[] A_0, Int32 A_1, Int32 A_2) at EO.Pdf.Internal.is.b(Byte[] A_0, Stream A_1, ah A_2, Int32 A_3) at EO.Pdf.Internal.g6.b(Byte[] A_0, String A_1, ah A_2, Int32 A_3) at EO.Pdf.Internal.g6.d() at EO.Pdf.Internal.dp.b() at EO.Pdf.Contents.PdfContentContainer.k() at EO.Pdf.Contents.PdfContentContainer.i() at EO.Pdf.PdfDocument.b() at EO.Pdf.PdfDocument.Merge(PdfDocument[] docs) at WP_Online.DocumentHelpers.PdfInterceptAttribute.CompileFinalDocument(Byte[] originalQuote, Int32 tempRateID, Guid id) in C:\DomaniProjects\WP-Online\Dev\WP-Online-Dev\WP-Online\DocumentHelpers\PdfInterceptAttribute.cs:line 132 at WP_Online.DocumentHelpers.PdfInterceptAttribute.OnResultExecuted(ResultExecutedContext filterContext) in C:\DomaniProjects\WP-Online\Dev\WP-Online-Dev\WP-Online\DocumentHelpers\PdfInterceptAttribute.cs:line 51
And the code:
fileList is List<byte[]> with 2-4 PDF documents as byte arrays.
//Merge the documents into one EO.Pdf.PdfDocument[] docs = new EO.Pdf.PdfDocument[fileList.Count]; for (int i = 0; i < fileList.Count; i++) { byte[] docByte = fileList.ElementAt(i); MemoryStream docStream = new MemoryStream(docByte); docs[i] = new EO.Pdf.PdfDocument(docStream); }
EO.Pdf.PdfDocument mergedDoc = EO.Pdf.PdfDocument.Merge(docs);
Any ideas where I can look to track this down?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
That occurs when we cannot decode a compressed data chunk in one of the PDF files. Please try to find out which PDF file that is and verify whether that file is valid. If that file appears to be valid and the code still fails, please reply again and we will provide the email address for you to send the PDF file. Once we have the file we will look into it and see what we can find.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2012 Posts: 4
|
Right you were, there was a problem with one of my PDFs....however, it is an EO.PDF.HtmlToPdf() generated pdf, which leads me to a new problem. I'll post in a new thread if I can't find an answer already in the forums.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
OK. ; ) We am not aware of such issues so probably it has never come up in the forum. If you can post the source code that is used to produce this PDF it would certainly help us to track down this issue.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2012 Posts: 4
|
The new problem is EO.Pdf.HtmlToPdfException: Convertion failed. Failed to initialize conversion.
The reason the PDF was no good was because it didn't exist. I have it working just fine on one site, and thought I had all the settings duplicated on this new test site, but alas I am wrong...again.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I see. There are a lot of different scenarios that can cause the HTML to PDF converter fail to initialize. We have just addressed another one. We just sent you a private message that contains download link to the latest build, please try that build and see if it addresses the fail to initialize issue for you. If it still does not, please see if you can reproduce the problem. Usually as soon as you can reproduce the problem, we will be able to get to the bottom of it.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2012 Posts: 4
|
That new build solved my converter initialization problem, so my HtmlToPdf is working again.
Now, I have found that the last document in my list of PDFs to be merged is also causing the original problem that I posted (header checksum illegal). This particular one is a byte[] that my code retrieves from a 3rd party webservice, so I have no control over how it is generated. I can write that byte[] to disk using File.WriteAllBytes() and produce a PDF that opens just fine in the two PDF viewers I have (Adobe and Nitro).
Is there any way to programatically check for a valid byte array?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Well. We can't tell you how unless we know what and why first. ; ) Please send us the file that's failing and we will look into it and see what we can find. It maybe a bug in our code, or maybe indeed an invalid file but other programs such as Adobe PDF Viewer is more tolerable. In any case, we will have to have the file in order to know for sure. We will PM you with our email address.
Thanks!
|
|