PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Feb 26, 2020 12:41 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Sep 23, 2009 12:21 pm 
Offline

Joined: Wed Sep 23, 2009 12:10 pm
Posts: 2
Hello,

I am using pdfsharp to generate a single bitmap of a pdf page. My pdf are the output of an ocr process from tiff files (using the abbyy recognition server).
I tried the ExportImage project and I really like it, it works fine and it is very fast to render the image.
I think that I found a bug when I am trying to generate a bitmap for a pdf page having the two filters: FlateDecode and DCTDecode.

In the public static byte[] Decode(byte[] data, PdfItem filterItem) method, it applies first the FlatDecode filter and then tries the DCTDecode. As the DCTDecode does not do anything, it returns null. I guess that it should then return the decoding result of the FlatDecode?

Here is what I changed:

before:
data = Filtering.Decode(data, item);

changed to:
data = Filtering.Decode(data, item) ?? data;

What do you think?


Thanks

Laurent


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 23, 2009 12:34 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3023
Location: Cologne, Germany
Hi!
laurentl wrote:
I think that I found a bug when I am trying to generate a bitmap for a pdf page having the two filters: FlateDecode and DCTDecode.

Is this a bug in PDFsharp or a bug in that PDF file?

It can't hurt to make PDFsharp more robust for document errors, but I'd like to know if that page still has both filters when it was opened and saved with Adobe Acrobat (not the Reader).

I'm afraid that ?? is not compatible with VS 2005, so I'd use an if instead.
I'll inform our experts about your proposal.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 23, 2009 12:56 pm 
Offline

Joined: Wed Sep 23, 2009 12:10 pm
Posts: 2
Hi Thomas,

I think that the bug is in PDFSharp in the line I made the change but I cannot be 100% sure. When I load the document with the Modify open mode, I also get this message:
Number of deleted unreachable objects XX.

I just tried to add some text to the page and save it. Unfortunately when I try then, I get an exception when trying to open the file: "Cannot handle iref streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6."
I then opened the file again with acrobat and in the EnFocus inspector tool and I can see that the page still has JPEG + ZIP filters.

Laurent


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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