Check the document’s editing status in Blazor SfPdfViewer Component

7 Oct 20241 minute to read

You can check whether the loaded PDF document is edited or not by using the IsDocumentEdited property of the SfPdfViewer.

The following code represents how to check the editing status of the document.

@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons

<SfButton @onclick="OnClick">Check</SfButton>
<SfPdfViewer2 @ref="Viewer"
              DocumentPath="@DocumentPath"
              Height="100%"
              Width="100%">
</SfPdfViewer2>

@code{
    public SfPdfViewer Viewer { get; set; }
    private string DocumentPath { get; set; } = "Data/PDF_Succinctly.pdf";

    //Prints the document's edited status in console window.
    public void OnClick(MouseEventArgs args)
    {
        Console.WriteLine(Viewer.IsDocumentEdited);
    }
}

View sample in GitHub.