Check whether the loaded PDF document is edited in Blazor SfPdfViewer
17 Jul 20261 minute to read
Use the IsDocumentEdited property to determine whether the loaded PDF has unsaved changes. A document is considered edited when users modify annotations, fill form fields, add or update signatures, apply redactions, or perform other in-viewer changes. The property returns true when the document has unsaved edits.
The following example shows how to check the document’s edited status and log it to the server console.
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="OnClick">Check</SfButton>
<SfPdfViewer2 @ref="Viewer"
DocumentPath="@DocumentPath"
Height="100%"
Width="100%">
</SfPdfViewer2>
@code{
private SfPdfViewer2 Viewer { get; set; }
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
// Logs the document's edited status to the console.
private void OnClick()
{
Console.WriteLine(Viewer.IsDocumentEdited);
}
}