How can I help you?
Check document editing status in Blazor SfPdfViewer Component
12 Feb 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.
@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 SfPdfViewer2 Viewer { get; set; }
private string DocumentPath { get; set; } = "Data/PDF_Succinctly.pdf";
// Logs the document's edited status to the console (null-safe).
public void OnClick(MouseEventArgs args)
{
Console.WriteLine(Viewer.IsDocumentEdited);
}
}