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. Image for the cookie policy date

SfPdfViewer set vertical offset of the page

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

1 Reply

BS Balasubramanian Sundararajan Syncfusion Team October 11, 2016 01:24 PM UTC

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 


Loader.
Up arrow icon