PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Fri Feb 20, 2015 1:45 pm 
Offline

Joined: Fri Feb 20, 2015 10:18 am
Posts: 1
If you try to open an PDF document with PDFsharp 1.32, you might get this exception:

Code:
Unhandled Exception: PdfSharp.Pdf.IO.PdfReaderException: Cannot handle iref streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6.

With PDFsharp 1.5 you will not get this exception, but there is a much bigger Problem! :shock:
If you try to open a document like this...

Code:
PdfDocument pd = PdfReader.Open(s);

... the program could get stuck in the function PdfReader.Open. :evil:

Please try to fix this bug.


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 22, 2015 6:10 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 339
Hi!
JahRkh wrote:
Please try to fix this bug.
Please submit the file that does not work to make sure the bug can be fixed.
There are many different "flavours" of PDF files.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2015 11:02 pm 
Offline

Joined: Mon Mar 09, 2015 10:32 pm
Posts: 1
Hi, I have come across this problem as well in version 1.50.3638.

PdfSharp hangs when calling the method PdfReader.Open() with the below PDF:

PDF example that hangs in version 1.5

Interestingly, the PDF does open fine in version 1.32.3057, however there are other PDF files that cause the open method to hang in version 1.32.3057. An example PDF is below:

PDF example that hangs in version 1.32

I have tried opening both PDF files using a release build as this advise had resolved similar problems. Unfortunately this hasn't solved this issue.

I was unable to locate the source code for version 1.5 and therefore could not find any further information on what is causing the problem.

Any help with this issue would be great.

Thanks,
Steve


Top
 Profile  
Reply with quote  
PostPosted: Thu May 21, 2015 10:18 am 
Offline

Joined: Fri Mar 20, 2015 1:00 pm
Posts: 13
Any news about this? And also can we expect a new beta soon? The last beta is 5 months old, I'm sure you've nailed some nasty bugs since! 8)


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 21, 2015 4:28 pm 
Offline

Joined: Fri Aug 21, 2015 11:22 am
Posts: 3
It seems I have a similar problem. Did any of you found a solution?


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 21, 2015 7:54 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
AFAIK all known bugs with respect to opening PDF files have been fixed with the latest internal builds of PDFsharp.
So wait patiently for the next beta. I don't know when it will come, but I hope it will come soon.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 23, 2015 12:41 am 
Offline

Joined: Tue Sep 22, 2015 10:55 pm
Posts: 2
I'm getting this issue, too (hung inside PdfReader.Open()): NuGet package PDFsharp-MigraDoc-wpf 1.50.3638-beta

... but I'm getting it only in the Exception Handler where I'm using this workaround: http://forum.pdfsharp.net/viewtopic.php?f=2&t=693&p=5855#p5855 which I'm using because of a "Unexpected end of file" PdfReaderException in the Open() command:

PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ParseObject(PdfSharp.Pdf.IO.Symbol stop) + 0x5c2 bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadDictionary(PdfSharp.Pdf.PdfDictionary dict, bool includeReferences) + 0x61 bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadObject(PdfSharp.Pdf.PdfObject pdfObject, PdfSharp.Pdf.PdfObjectID objectID, bool includeReferences, bool fromObjecStream) + 0x17a bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadCompressedObject(int objectNumber, int offset) + 0x44 bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadCompressedObject(PdfSharp.Pdf.PdfObjectID objectID, int index) + 0x13d bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.PdfReader.Open(System.IO.Stream stream, string password, PdfSharp.Pdf.IO.PdfDocumentOpenMode openmode, PdfSharp.Pdf.IO.PdfPasswordProvider passwordProvider) + 0x52f bytes
PdfSharp-wpf.dll!PdfSharp.Pdf.IO.PdfReader.Open(System.IO.Stream stream, PdfSharp.Pdf.IO.PdfDocumentOpenMode openmode) + 0x11 bytes

(Note that the NuGet beta doesn't include .pdb files, so I only have IL offsets.)

Any chance of treating this like an open-source project, where we can at least make our own forks to try to fix the specific problems we're having? I wouldn't necessarily expect you to take PRs, although of course, that might help you, too...

Or, maybe a super-detailed logging mode that could be enabled to help understand how we might modify the existing PDF file to make it successfully open?

Thanks,
->A


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 23, 2015 5:41 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
CodeCharm wrote:
I'm getting this issue, too (hung inside PdfReader.Open()): NuGet package PDFsharp-MigraDoc-wpf 1.50.3638-beta
That's the old beta.
If the problem persists with the current beta (1.50.3915-beta2) then it will be investigated if empira receives a sample file that allows to replicate the error.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 23, 2015 10:16 pm 
Offline

Joined: Tue Sep 22, 2015 10:55 pm
Posts: 2
Thanks! That seems to have done the trick. The document loads without hanging.

BTW - I could not get the PdfSharp-MigraDoc-Gdi beta2 to properly render private fonts, even though I need to run this as a Web service. I had to resort to using PdfSharp-MigraDoc-Wpf beta2 for the private fonts to render. Also, XPrivateFontCollection.Add seems to work; I didn't have to implement IFontResolver. That seems to run against other instructions I've seen (http://stackoverflow.com/questions/27606877/pdfsharp-private-fonts-for-azure-1-50), so I don't know if it's working by accident (undocumented feature?) or if you meant for us to use it.


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 30, 2015 9:28 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Font management is still under construction.

With respect to PDFsharp 1.50 beta 2:
  • For GDI build use XPrivateFontCollection (IFontResolver does not work)
  • For WPF use XPrivateFontCollection if you use DocumentPreview, otherwise IFontResolver can also be used
  • For other platforms IFontResolver should be the method of choice

Maybe IFontResolver will work with a stable version of PDFsharp 1.50, maybe it won't.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

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