PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 4:32 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Nov 26, 2015 1:15 pm 
Offline

Joined: Fri Mar 20, 2015 1:00 pm
Posts: 13
Hi,

I'm trying to combine two pdf's using your sample code, http://www.pdfsharp.net/wiki/CombineDoc ... ample.ashx.
But PdfSharp throws the following exception: PdfSharp.SharpZipLib.SharpZipBaseException: Deflated stream ends early on line: gfx = XGraphics.FromPdfPage(page1);

Testapplication including a pdf as well as a workaround in the comments in static void Main(string[] args)
can be found here: Example file removed.

Is this something that can be fixed in your end or is there something wrong with my pdf?

Reason for edit: Example file removed.


Last edited by johnzered on Thu Dec 10, 2015 2:12 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 26, 2015 1:49 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
johnzered wrote:
Is this something that can be fixed in your end or is there something wrong with my pdf?
Thanks for the feedback. At first glance it looks like a problem with our library (with an external library used by our library actually), but I cannot address this issue this week.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 04, 2015 8:34 am 
Offline

Joined: Fri Mar 20, 2015 1:00 pm
Posts: 13
Have you had time to investigate this issue any further?


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 10, 2015 8:08 am 
Offline

Joined: Fri Mar 20, 2015 1:00 pm
Posts: 13
I'm sorry to keep nagging about this but it's crucial for our own development to know if you think there's something you can do about this.
We are not in an immediate rush so if you're working on this or thinks there's a problem you will be able to solve it's okay, just want to here your comments.


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 10, 2015 9:25 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
I've updated PDFsharp to use the latest version of the SharpZipLib and the problem persists.

In 10+ years I think this is the first valid PDF file that cannot be read by PDFsharp because of what seems to be a bug in SharpZipLib.
Looks like a problem that occurs with one in a million files.

I think I cannot solve it.

You can try to solve it, now that the source code for PDFsharp is available.

I don't know if the SharpZipLib Team is willing to help with this problem. I'm afraid it'll take hours to create a small example that replicates the problem and allows them to investigate and fix the issue.
I'm afraid we won't address this problem in the near future. We have bigger problems to deal with.

I don't understand why this file is crucial for you.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 10, 2015 2:09 pm 
Offline

Joined: Fri Mar 20, 2015 1:00 pm
Posts: 13
The PDF provided in the tesproject was just used as an example and has absolutely no meaning to me what so ever. But I cannot provide you with a real world business document and actually that doesn't matter as the error occurs with any of our documents.
As mentioned in the comments of the example project (in Main method) we convert RTF files to PDF using a third party library and every PDF created with that library fails to be combined using your library.

Also in the comments I explained about a fix for this issue:

Changing the code in a file called FlateDecode.cs in the current codeplex source code after the #else for #if NET_ZIP into
Code:
byte header;   // 0x30 0x59
header = (byte)msInput.ReadByte();
//Debug.Assert(header == 48);
header = (byte)msInput.ReadByte();
//Debug.Assert(header == 89);

InflaterInputStream iis = new InflaterInputStream(msInput, new Inflater(true));
from just
Code:
InflaterInputStream iis = new InflaterInputStream(msInput, new Inflater(false));

The problem is we do not know the side effects of such a change.

Thank you for your help.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 52 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