The code below is working for 100s of documents. But one of the document it is failing on the pdfReader.Open(ms, pdfDocumentOpenMode.Import). The document can be downloaded and opened in browser just fine.
I can't share the document publically, I am happy to email it privately for testing.
//code MemoryStream ms = new MemoryStream(attachment.File_Contents); using (PdfDocument pdfDoc = PdfReader.Open(ms, PdfDocumentOpenMode.Import)) { } ms.Close(); ms.Dispose();
Error: Value was either too large or too small for an Int64. StackTrace: at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) at PdfSharp.Pdf.IO.Lexer.ScanNumber() at PdfSharp.Pdf.IO.Lexer.ScanNextToken() at PdfSharp.Pdf.IO.Parser.ParseObject(Symbol stop) at PdfSharp.Pdf.IO.Parser.ReadDictionary(PdfDictionary dict, Boolean includeReferences) at PdfSharp.Pdf.IO.Parser.ReadObject(PdfObject pdfObject, PdfObjectID objectID, Boolean includeReferences, Boolean fromObjecStream) at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider) at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openmode)
|