Syncfusion AI Assistant

How can I help you?

Check the loaded document is edited or not

5 Sep 20251 minute to read

The PDF Viewer allows you to check whether the loaded PDF document has been modified during the viewing session. This helps determine if you need to prompt the user to save changes before exiting or closing the document.The IsDocumentEdited property of the PDF Viewer provides a simple way to determine whether the loaded document has been modified it’s returning true,and false if no modifications have occurred.

public MainWindow()
{
    InitializeComponent();
    // Load the specified PDF file.
    pdfViewer.Load("Document.pdf");
    // Attach an event handler to the Closed event of the window.
    this.Closed += MainWindow_Closed;
}
private void MainWindow_Closed(object sender, EventArgs e)
{
    bool isPDFEdited = pdfViewer.IsDocumentEdited;

    if (isPDFEdited)
    {
        MessageBox.Show("The PDF document has been edited.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
    }
    else
    {
        MessageBox.Show("The PDF document has not been edited.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
    }
}