Skip to content

Can't Open File (PdfSharp.Pdf.IO.ObjectNotAvailableException) #347

@wessleym

Description

@wessleym

Thank you for PDFsharp!

I'm trying to read a file with PDFsharp 6.2.4. To me, the file does not seem corrupt since my PDF reader can open it. Upon calling PdfSharp.Pdf.IO.PdfReader.Open, I get the below exception. I'm including the file: CR1.pdf. Thank you for your help.

Exception:
Type: PdfSharp.Pdf.IO.ObjectNotAvailableException
Message:
Cannot retrieve stream length.
PDFsharp cannot read this PDF file. If you think your file is a valid PDF file please send it to us so that we can fix this bug in the PDF parser.
Stack Trace:
at PdfSharp.Pdf.IO.Lexer.<>c.b__17_0()
at PdfSharp.Internal.SuppressExceptions.HandleError(SuppressExceptions suppressExceptions, Action throwException)
at PdfSharp.Pdf.IO.Lexer.DetermineStreamLength(Int64 start, Int32 searchLength, SuppressExceptions suppressObjectOrderExceptions)
at PdfSharp.Pdf.IO.Parser.ReadDictionaryStream(PdfDictionary dict, SuppressExceptions suppressObjectOrderExceptions)
at PdfSharp.Pdf.IO.Parser.ReadObjectInternal(PdfObject pdfObject, PdfObjectID objectID, Boolean includeReferences, Boolean fromObjectStream, SuppressExceptions suppressObjectOrderExceptions)
at PdfSharp.Pdf.IO.Parser.ReadIndirectObject(PdfReference pdfReference, SuppressExceptions suppressObjectOrderExceptions, Boolean withoutDecrypting)
at PdfSharp.Pdf.IO.Parser.ReadAllIndirectObjects()
at PdfSharp.Pdf.IO.PdfReader.OpenFromStream(Stream stream, String password, PdfDocumentOpenMode openMode, PdfPasswordProvider passwordProvider, PdfReaderOptions options)
at PdfSharp.Pdf.IO.PdfReader.OpenFromFile(String path, String password, PdfDocumentOpenMode openMode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(String path, PdfDocumentOpenMode openMode, PdfReaderOptions options)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions