Check the document’s editing status in Blazor PDF Viewer Component

17 Dec 20221 minute to read

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

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

@using Syncfusion.Blazor.PdfViewer
@using Syncfusion.Blazor.Buttons

<SfButton @onclick="OnClick">Check</SfButton>
<SfPdfViewer @ref="Viewer" 
             DocumentPath="@DocumentPath" 
             Height="640px" 
             Width="100%" 
             ServiceUrl="https://ej2services.syncfusion.com/production/web-services/api/pdfviewer">
</SfPdfViewer>

@code{
    public SfPdfViewer Viewer { get; set; }

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

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

NOTE

View sample in GitHub.