I have a pdf document that cannot be opened using the following code:
Code:
var byteArray = File.ReadAllBytes("test.pdf");
using (var pdfOut = new PdfDocument())
{
using (var msInput = new MemoryStream(byteArray))
{
var inputDocument = PdfReader.Open(msInput, PdfDocumentOpenMode.Import);
foreach (PdfPage page in inputDocument.Pages)
{
pdfOut.AddPage(page);
}
}
using (var msOutput = new FileStream("out.pdf", FileMode.Create, FileAccess.Write))
{
pdfOut.Save(msOutput);
}
}
I use the latest code of PdfSharp. When I debug using the source code, I can see the error occurs in Lexer.cs line 164, because it does not recognize a soft hyphen (char 173).
I can send you the pdf by e-mail for debugging purposes, but I'm not allowed to publish on the web.
Can you look at this error, please. It's very much appreciated