PdfViewer move scrollbar to annotation location

Hello,

Is there a way to move scrollbar to annotation location with the pdfviewer component.
I know the gotopage method but not a methode scrollbar gotTo Y coordinate.
Thanks in advance,
Nicolas

8 Replies 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team March 22, 2021 09:58 AM UTC

Hi Nicolas, 
 
Thanks for contacting Syncfusion support. 
 
We can move the scrollbar to annotation location using GoToBookmark method. Please refer to the below sample and code snippet, 
 
 
 
Code Snippet: 
 
<button @onclick="navigate">Navigation</button> 
 
private async void navigate() 
    { 
        var annotationCollection = await PDFViewer.GetAnnotations(); 
        var pageNumber = annotationCollection[0].PageNumber; 
        var Y = annotationCollection[0].Bound.Top; 
        PDFViewer.GoToBookmark(pageNumber, Y); 
    } 
 
 
Kindly try this and revert to us with more details if you have any concerns about this. 
 
Regards, 
Vasugi 



NN Nicolas NOEL March 29, 2021 04:50 PM UTC

Hi Vasugi,

I'm testing the sample code but my bound are always at null it's normally ?

I send you a sample code to reproduce in attachement. 

- When you launch my sample clic on this menu : 

 

- And clic on field on the left menu to load annotation 



- And clic on TEST button to lauch the code bottom




NN Nicolas NOEL March 29, 2021 06:46 PM UTC

Sample code 
Thank you
Attachment: BlazorAppPOC__BUG_BOUND_ANNOTATION_6a3bd5fc.zip


VS Vasugi Sivajothi Syncfusion Team March 30, 2021 11:07 AM UTC

Hi Nicolas,  
 
Thanks for the update. 
 
We were able to reproduce the reported issue with the provided sample. We will analyze further on this and update you with more details on April 1, 2021. 
 
Regards, 
Vasugi 



VS Vasugi Sivajothi Syncfusion Team April 1, 2021 04:04 PM UTC

Hi Nicolas,  
 
We have confirmed that “Text markup Annotation bounds return as null while get the Annotation Collection in Blazor” issue is a defect and logged the defect reported for the same. The fix for this issue will be included in our upcoming weekly nuget release on 14, April 2021. You can track the status using the below feedback link. 
 
 
Regards, 
Vasugi 



VS Vasugi Sivajothi Syncfusion Team April 14, 2021 01:15 PM UTC

Hi Nicolas,   
 
We have fixed the reported “Text markup Annotation bounds return as null while get the Annotation Collection in Blazor” issue and the fix was included in our latest weekly NuGet release v19.1.0.56. Kindly upgrade to that version to get the issue resolved. 
 
Packages link:    
Blazor Client  
Blazor Sever 
Service side package    
ASP.NET Core :    
     
ASP.NET MVC:    
   
CDN links:   
 
Regards, 
Vasugi 


Marked as answer

NN Nicolas NOEL April 15, 2021 08:14 AM UTC

Hi Vasugi,

Thank you for the fix, it's works for get the bound Y coordinate ("var Y = annotationCollection[0].Bound.Top;"), but not works has expected  for the "await Viewer.GoToBookmark(pageNumber, Y);" method because with :

pageNumber = 0
Y = 48,609375

I go to the second page of my pdf ???

Print screen of my code in sample I send you


You can reproduce with the sample I send you before.

1) When you launch my sample clic on this menu : Viewer8 Bug bound
2) And clic on field on the left menu to load annotation => the first
3) Click on TEST button
4) you see the pdf viewer got to second page


Thanks
Nicolas



VS Vasugi Sivajothi Syncfusion Team April 16, 2021 12:49 PM UTC

Hi Nicolas, 
 
Thank you for the update. 
 
We have checked with the provided details, we can move the scrollbar to the exact location of all the annotations using the below code snippet. We have shared the modified sample for your reference. Kindly upgrade to the latest version and refer to the below code snippet and the sample. 
 
Code Snippet: 
 
<SfPdfViewerServer @ref="PdfViewer" DocumentPath="@DocumentPath"> 
    <PdfViewerEvents DocumentLoaded="DocumentLoad"></PdfViewerEvents> 
</SfPdfViewerServer> 
 
@code{ 
public Dictionary<int, System.Drawing.SizeF> pageSize { get; set; } 
 
    private void DocumentLoad(LoadEventArgs args) 
    { 
        pageSize = args.PageData.PageSizes; 
    } 
 
private async void navigate() 
    { 
        var annotationCollection = await PdfViewer.GetAnnotations(); 
        var pageNumber = (annotationCollection[0].PageNumber); 
        var Y = annotationCollection[0].Bound.Top; 
        await PdfViewer.GoToBookmark(pageNumber, (pageSize[pageNumber].Height - Y)); 
    } 
} 
 
Kindly try this and revert to us with more details if the provided solution is not meet your requirement. 
 
Regards, 
Vasugi 


Loader.
Up arrow icon