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

Wrong page number when reading a simple pdf #129

Open
ffbboy30 opened this issue Jun 28, 2024 · 6 comments
Open

Wrong page number when reading a simple pdf #129

ffbboy30 opened this issue Jun 28, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@ffbboy30
Copy link

Hello,
PDFsharp-gdi.zip

The problem is simple the nNbpages is 1 instead of 14

Here is my code from the issue template
The code is quite simple
var pdfDocument = PdfReader.Open("CE EMR 8029635 - TCE-121190056.pdf"); int NbPages = pdfDocument.Pages.Count; Console.WriteLine(NbPages.ToString());

I put the pdf file in the debug directory

Thanks for your help

@ThomasHoevel
Copy link
Member

It would have been much easier if you would have used the template as intended. You sent a ZIP file without code and without .SLN file.

PDFsharp only find 1 page. Further investigation pending.

@ThomasHoevel ThomasHoevel added bug Something isn't working investigation Under investigation labels Jul 1, 2024
@ffbboy30
Copy link
Author

ffbboy30 commented Jul 1, 2024

Sorry here is the full template
Full template.zip

Use the PDFsharp-gdi solution
Thanks

@ThomasHoevel
Copy link
Member

Please note that this is not a "simple PDF".

When opened with Google Chrome, there is only a single page. That's the only regular page in the PDF and that's the page that PDFsharp also finds.
When opened with Adobe Reader, there are 14 pages.
When opened with Firefox, there are 24 pages.
Opera and SumatraPDF only find one page.

@ThomasHoevel ThomasHoevel added enhancement New feature or request and removed bug Something isn't working investigation Under investigation labels Jul 8, 2024
@ffbboy30
Copy link
Author

ffbboy30 commented Jul 8, 2024

Thanks to take time to answer.
So, Is there a solution to get the good number of page 14 with pdfsharp because my application use the pdfsharp api.

Thanks

@ThomasHoevel
Copy link
Member

AIUI Adobe Reader creates the 14 pages "on the fly" from meta data included in the PDF and Firefox creates 24 pages from the same meta data.

PDFsharp does not have the capabilities to render those pages "on the fly". I did not check if you can easily access the meta data using PDFsharp.

@ffbboy30
Copy link
Author

ffbboy30 commented Jul 9, 2024

Yesterday , I've tested with the adobe API and it found only 1 page too.
Is it possible to read this metadata directly and bypass pdfsharp only for the number of pages ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants