Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Aug 02, 2024 8:11 am

Hello

How can I get current Page Number of the Page which is being scrolled ?
i.e When Scrolling Page 1 down to Page 2 and so on and Vice versa.

so if the Page 2 of above mentioned File is being displayed in PdfDocumentViewer1
then Textbox1.Text to display as 2 or Page 2.
This is the current page being viewed so textbox1.text to get value of current page
If Yes, Then How ?

Your input will always be appreciated

Code: Select all
Dim dirPath As String = "C:\Reports"
Dim pdfDoc As Spire.Pdf.PdfDocument = New Spire.Pdf.PdfDocument()
       pdfDoc.LoadFromFile(dirPath & "\" & "Record-11234.PDF")
       PdfDocumentViewer1.LoadFromFile(dirPath & "\" & "Record-11234.PDF")



Thanks
SamDsouza
14

SamDsouza
 
Posts: 23
Joined: Wed Jan 31, 2024 11:05 am

Mon Aug 05, 2024 7:55 am

Hi,

Thank you for your message.
I'm sorry, but I didn't quite understand your meaning.
Are you trying to retrieve the page number of the current page? If so, you can use 'Me.pdfDocumentViewer1.CurrentPageNumber
' to get it. The page number of the current page should be the one you're referring to as the page that is currently being scrolled through. If my understanding is incorrect, please provide a more detailed description. Thanks in advance for your assistance.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Mon Aug 05, 2024 10:04 am

If so, you can use 'Me.pdfDocumentViewer1.CurrentPageNumber

The above was required in PdfDocumentViewer1_PageNumberChanged(,,,,,, Event.
Ok I got it
Thank you so much for your reply. Indeed it Works

and How to Show Blank/Completely Empty in PDFDocumentViewer1 if GotoPage = "" or 0
Your Help shall be appreciated.

Thanks
SamDsouza
15

SamDsouza
 
Posts: 23
Joined: Wed Jan 31, 2024 11:05 am

Tue Aug 06, 2024 2:45 am

Hi,

Thank you for your feedback.
I'm glad my previous response was helpful. Unfortunately, our Spire.PDFViewer displays pages based solely on the PDF file. It cannot display non-existent pages, just as Adobe is unable to show pages that do not exist in the PDF. I hope you can understand this limitation.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Tue Aug 06, 2024 5:56 am

Dear Loris

It cannot display non-existent pages, just as Adobe is unable to show pages that do not exist in the PDF. I hope you can understand this limitation.


Ok I agree

Thank you so much for your help and solution. But Just wanted to know Why the PDF gets more time to get uploaded with below coding
PdfDocumentViewer1.LoadFromFile(dirPath & "\" & "Record-11234.PDF")

Thanks
SamDsouza
16

SamDsouza
 
Posts: 23
Joined: Wed Jan 31, 2024 11:05 am

Tue Aug 06, 2024 9:57 am

Hi,

Thank you very much for your understanding.
Are you referring to the fact that PdfDocumentViewer1.LoadFromFile() takes longer than PdfDocument.LoadFromFile()? This is because PdfDocument is a product without a graphical user interface (GUI) and primarily focuses on parsing the file during loading, whereas PdfDocumentViewer1 needs to render the GUI during loading, which naturally takes more time.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.PDF