PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

pdfreader.open is missing the 1st page
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4132
Page 1 of 1

Author:  MarcoBee [ Thu May 07, 2020 11:09 pm ]
Post subject:  pdfreader.open is missing the 1st page

Hi,
when I do pdfreader.open:
===========
Try
InputDocument = PdfReader.Open(PercorsoFileFormulari, PdfDocumentOpenMode.Import)
Catch ex As Exception
===========
(where PercorsoFileFormulari is the full path PDF location - sorry for the Italian) on a particular PDF file (2 pages), I miss the first page.

I develop in VB/VS2019. I never had this issue before (as far as I know..) by years that I am using my code (from VS2015 to VS2017 and 2019) as well as PDFReader. So this appears to be a very very special case.

Could someone please help me?
Thanks

Author:  TH-Soft [ Fri May 08, 2020 8:00 am ]
Post subject:  Re: pdfreader.open is missing the 1st page

Most likely a corrupt PDF file.

Author:  MarcoBee [ Fri May 08, 2020 11:02 pm ]
Post subject:  Re: pdfreader.open is missing the 1st page

Quote:
Most likely a corrupt PDF file.


You right. After your suggestion I verified it is a corrupt file. I also verified that other PDF readers read the pages number correctly, i.e. 2.

This is a serious problem. I use PDFSharp in an application that create 1 PDF file from *each* page of incoming PDF. In this moment I don't know what the real number of pages number for that file is.
It means I can't take any countermeasure or rely on any workaround, which instead is the case for corrupted PDF file I already met (in this case I open+save that PDF in another reader and after that use PDFSharp).
So missing the correct numer of pages means that I loose documents, and I will never know it existed. This is a serious issue for using PFSharp in an application.

Is there a way to overcome this problem?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/