We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

SfPdfViewer set vertical offset of the page

Thread ID:

Created:

Updated:

Platform:

Replies:

126349 Oct 10,2016 09:20 AM Oct 11,2016 09:24 AM UWP 1
loading
Tags: SfPdfViewer
Flikkema
Asked On October 10, 2016 09:20 AM

Hi. What is the correct way to set a vertical offset of the page? For example, I get the current offset value like:

var verticalOffset = pdfViewer.VerticalOffset;

And than in few moments later I try to set it like:

pdfViewer.ScrollToVerticalOffset(verticalOffset);

But offset is always set to 0. 


Thanks in advance

Balasubramanian Sundararajan [Syncfusion]
Replied On October 11, 2016 09:24 AM

Hi Bohdan, 

Thank you for using Syncfusion product. 

We can achieve the requirement of scrolling to the particular offset of the PDF viewer control by getting the current vertical scroll position of PDF viewer in button click event. Please find the code example from below, 

Code Example: 

Below code example which retrieves the current scroll offset position of the PDF viewer control UWP. 

 
 
private void PdfViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) 
{ 
     
    // Retrieves the current vertical offset of the PDF viewer control. 
    textBox2.Text = (pdfViewer.VerticalOffset).ToString(); 
 
} 

 

Below code example which allows us to navigate to the specified offset in the PDF viewer control UWP. 

 
private void button_Click(object sender, RoutedEventArgs e) 
{ 
      
     float verticalOffset = float.Parse(textBox.Text); 
 
     //To navigate to the specified offset in the PDF viewer control. 
     pdfViewer.ScrollToVerticalOffset(verticalOffset); 
 
} 

 


We have also create a simple sample which illustrates in navigating to the particular offset in the PDF viewer control using the ScrollToVerticalOffset method and the sample can be downloaded from the following link, 


If are still facing any problem in retrieving the current offset and scrolling to the specific offset of the PDF viewer control kindly get back to us with more details on your query. 

Thanks, 
Balasubramanian S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;