PDFsharp icon indicating copy to clipboard operation
PDFsharp copied to clipboard

System.InvalidOperationException: 'Stream cannot be read. Please send us the PDF file so that we can fix this (issues (at) pdfsharp.net).'

Open robrechtD opened this issue 1 year ago • 2 comments

Opening a pdf from a stream produces the following exception:

System.InvalidOperationException: 'Stream cannot be read. Please send us the PDF file so that we can fix this (issues (at) pdfsharp.net).' I've attached a project to reproduce the issue.

PDFsharp.IssueSubmissionTemplate.zip

robrechtD avatar Aug 09 '24 11:08 robrechtD

Thanks for the feedback. The PDF file is corrupted in object 14 0. The object has an empty stream, but the length is given as 2338 bytes and that's more bytes than there are remaining in the file.

14 0 obj
<</Length 2338
/Type
/Metadata
/Subtype 
/XML>>
stream
endstream

We try to improve PDFsharp with respect to reading corrupted files, but I cannot say if or when a workaround for that corruption will come.

ThomasHoevel avatar Aug 09 '24 11:08 ThomasHoevel

@ThomasHoevel I just added a commit to #152 that handles this situation.

packdat avatar Aug 17 '24 13:08 packdat

Issue should be resolved with PDFsharp 6.2.0 Preview 2.

ThomasHoevel avatar Dec 12 '24 14:12 ThomasHoevel