empira / PDFsharp

PDFsharp and MigraDoc Foundation for .NET 6 and .NET Framework
https://docs.pdfsharp.net/
Other
531 stars 132 forks source link

Import pdf file error #190

Open ziheng-dev opened 1 month ago

ziheng-dev commented 1 month ago

I am using the PDFsharp 6.2.0 Preview 1 in a .net 8 project.

It shows me this error "Stream cannot be read. Please send us the PDF file so that we can fix this (issues (at) pdfsharp.net)." when I try to import this pdf file.

TS-18_0001.pdf

this is part of my code:

var pdfBytes = File.ReadAllBytes(filePath); using (var readMemoryStream = new MemoryStream(pdfBytes)) { PdfDocument inputDocument = PdfReader.Open(readMemoryStream, PdfDocumentOpenMode.Import); }

please help to check, Thanks.

ThomasHoevel commented 1 month ago

The file is corrupted. Adobe Reader can fix it (try File / Save as). PDFsharp cannot yet fix it.