Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PdfReader.Open will not open a document #216

Closed
gtmorrell opened this issue Dec 12, 2024 · 7 comments
Closed

PdfReader.Open will not open a document #216

gtmorrell opened this issue Dec 12, 2024 · 7 comments
Labels
enhancement New feature or request forum Please use Discussions or the Support forum to ask Support questions - https://forum.pdfsharp.net/

Comments

@gtmorrell
Copy link

First, thank you for providing such a great tool.

The code I am having an issue with this code:

// RawFileNames[i] is a list of PDF File Names.

int numberOfPages;
using (PdfDocument existingPdf = PdfReader.Open(RawFileNames[i], PdfDocumentOpenMode.Import))
{
numberOfPages = existingPdf.PageCount;
}

The attached file is creating the issue.
JMH roof stairs.pdf

The Unhandled Exception I am getting is:
PdfSharp.Pdf.IO.ObjectNotAvailableException: '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.'

Todd

@ThomasHoevel
Copy link
Member

Have you tried PDFsharp 6.2.0 Preview 2?

@gtmorrell
Copy link
Author

I have tried loading it on both 6.1.1 and 6.2.0 and it gives the same exception. I ran an older version on my software and was able to load the Pdf, but I'm not sure what version it was running on. I think 6.1.0. I have updated to .NET 8.0 awhile ago so I can't use 6.1.0

@ThomasHoevel
Copy link
Member

Have you tried PDFsharp 6.2.0 Preview 2?

@ThomasHoevel ThomasHoevel added enhancement New feature or request forum Please use Discussions or the Support forum to ask Support questions - https://forum.pdfsharp.net/ labels Dec 13, 2024
@ThomasHoevel
Copy link
Member

Corrupted PDF file, not yet supported by PDFsharp.

@gtmorrell
Copy link
Author

gtmorrell commented Dec 13, 2024

Thank you for the quick response. I am asking this next question for clarity. Why would it work a with previous versions PDFSharp? The PdfSharp DLLs are dated 11/6/23

@ThomasHoevel
Copy link
Member

ThomasHoevel commented Dec 16, 2024

Why would it work a with previous versions PDFSharp?

The consistency check was laxer with 6.0.0 and is stricter with 6.1.0 and newer.
Version 6.2.0 Preview 2 can read corrupted files from HP Scan software that cannot be read by version 6.0.0.
Version 6.0.0 can read files from Bluebeam library like your file that cannot be read by 6.2.0 Preview 2.
We'll try to find a way that can read both types of files.

@ThomasHoevel
Copy link
Member

Duplicate of #186

@ThomasHoevel ThomasHoevel marked this as a duplicate of #186 Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forum Please use Discussions or the Support forum to ask Support questions - https://forum.pdfsharp.net/
Projects
None yet
Development

No branches or pull requests

2 participants