Check the status of annotations or comments in Blazor SfPdfViewer Component

21 Jun 20232 minutes to read

The Syncfusion’s Blazor SfPdfViewer component allows to check the status of the annotations in the SfPdfViewer using the Review property of the PdfAnnotation class.

The following code example shows the review status of the annotation.

@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
@inject IJSRuntime JsRuntime;

<SfButton OnClick="reviewStatus">Review Status</SfButton>
<SfPdfViewer2 @ref="pdfviewer"

    private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";

    SfPdfViewer2 pdfviewer;    

    //Prints the comment status of the PDF document in console.
    public async void reviewStatus()
        //Gets the annotation collection.
        List<PdfAnnotation> annotationCollection = await pdfviewer.GetAnnotationsAsync();
        for (var x = 0; x < annotationCollection.Count; x++)
            PdfAnnotation annotation = annotationCollection[x];
            //Gets the review status details of the comment.
            Review review = annotation.Review;
            var reviewState = review.State;
            var reviewStateModel = review.StateModel;
            await this.JsRuntime.InvokeVoidAsync("console.log",reviewState.ToString());

View sample in GitHub.

See also