PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jun 20, 2018 8:43 pm

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: Mon Nov 06, 2017 10:52 am 
Offline

Joined: Mon Nov 06, 2017 10:45 am
Posts: 5
Hi There,

I just upgraded from the stable 1.32.3057 to the beta 1.50.4619-beta4c and some PDF documents cannot be read (I cannot provide those documents as they are confidential), but I can provide the error:
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.PrepareRC4Key(Byte[] key, Int32 offset, Int32 length)
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.EncryptDictionary(PdfDictionary dict)
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.EncryptObject(PdfObject value)
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.EncryptDocument()
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openmode)
at Program.GetPDF() in MY_PROJECT
at Program.Main(String[] args) in MY_APP

I upgraded to 1.50.4619-beta4c because it enabled me to do something i cant quite remember why I couldn't do it with the non beta version (was 2-3 months ago)
I was able to load the files with v1.32.3057


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 06, 2017 12:29 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2817
Location: Cologne, Germany
Note for self: Similar issue with sample code on GitHub:
https://github.com/empira/PDFsharp/issues/31

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 06, 2017 1:52 pm 
Offline

Joined: Mon Nov 06, 2017 10:45 am
Posts: 5
Now I have it happening on another module of our code where we split a pdf into multiple pdf files (please see the attached file for more details).


Attachments:
ProcessFileError.png
ProcessFileError.png [ 23.18 KiB | Viewed 1637 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 06, 2017 4:37 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2817
Location: Cologne, Germany
It seems this problem occurs with beta 4c, but not with beta 4.
When using NuGet packages, consider going back to beta 4 until a new version comes out.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 07, 2017 7:14 am 
Offline

Joined: Mon Nov 06, 2017 10:45 am
Posts: 5
Ok, I'll give it a try and see if that fixes our issue.

Thank you.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 07, 2017 1:13 pm 
Offline

Joined: Mon Nov 06, 2017 10:45 am
Posts: 5
Does not work with beta4, its the same issue again.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 07, 2017 2:02 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2817
Location: Cologne, Germany
FACAMK wrote:
Does not work with beta4, its the same issue again.
I guess there are two issues:
  • Crash at PdfReader.Open
  • Crash at PageCount
The former may not occur with beta 4 (but we don't have a PDF file to test it), the latter is a different matter.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 07, 2017 2:29 pm 
Offline

Joined: Mon Nov 06, 2017 10:45 am
Posts: 5
I downgraded to 1.32 and this is the error I get when reading the document:
at PdfSharp.Pdf.PdfPages.GetKids(PdfReference iref, InheritedValues values, PdfDictionary parent)
at PdfSharp.Pdf.PdfPages.FlattenPageTree()
at PdfSharp.Pdf.Advanced.PdfCatalog.get_Pages()
at PdfSharp.Pdf.PdfDocument.get_Pages()
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openmode)

The document has the properties listed int the attached image.
Attachment:
Screenshot_7.png
Screenshot_7.png [ 16.05 KiB | Viewed 1626 times ]

Attachment:
DocProperties.png
DocProperties.png [ 17.93 KiB | Viewed 1626 times ]


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 29, 2017 4:09 pm 
Offline

Joined: Mon Jul 17, 2017 6:00 am
Posts: 1
I also have the same issue on PageCount.
Actually I use PDFSharp in VB.Net only for splitting pages from incoming PDFs. We get PDF files via mail by several senders, and I saw that this problem arises only with the PDFs from a specific sender.

I tried the beta4c release, as well as beta4 and last stable release 1.32.3057 + some previous release: in every case, I have the same issue on the same PDF type (I guess that sender creates the same type of PDF).
I can of course provide specifici PDF samples.

Is there (or will be) any solution to this issue?

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 29, 2017 4:40 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2817
Location: Cologne, Germany
MarcoBee wrote:
Is there (or will be) any solution to this issue?
If the PDF file complies with the PDF specification then we will try to support it, i.e. make PDFsharp open it correctly.
If the PDF file is corrupt then we may not be able to alter PDFsharp to read it.

Some initialization is done when calling PageCount for the first time. Various forms of corrupted PDF files can lead to problems at that point. Maybe that one sender uses a tool that produces incorrect PDF files.

_________________
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: Baidu [Spider] and 6 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