pdfviewer currentpagechanged event

1 Answer 67 Views
PdfViewer and PdfViewerNavigator
Claude
Top achievements
Rank 1
Iron
Veteran
Claude asked on 04 Feb 2022, 05:54 PM

I am using the following code in the currentpagechanged event to update a spin editor, but the spin editor value does not stay in sync with the Navigator text box when changing pages via the Navigator or clicking on the thumbnails.  

 

private void radPdfViewer1_CurrentPageChanged(object sender, CurrentPageChangedEventArgs e)
        {
            try
            {
                seFrom.Value = int.Parse(this.radPdfViewerNavigator1.CurrentPageTextBox.Text) ;
            }
            catch
            {

            }
        }

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 08 Feb 2022, 01:56 PM

Hi Claude,

I have tested this with the following approach for getting the page index and it works on my side: 

private void RadPdfViewer1_CurrentPageChanged(object sender, CurrentPageChangedEventArgs e)
{
    if (e.CurrentPage == null || radPdfViewer1.Document == null)
    {
        return;
    }
    radSpinEditor1.Value = radPdfViewer1.Document.Pages.IndexOf(e.CurrentPage) + 1;
}

Let me know how this works for you.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PdfViewer and PdfViewerNavigator
Asked by
Claude
Top achievements
Rank 1
Iron
Veteran
Answers by
Dimitar
Telerik team
Share this question
or