Skip to content

905508:How to check loaded pdf is edited or not in WPF PdfViewer #1748

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: hotfix/hotfix-v29.1.33
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wpf-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,7 @@
<li><a href="/wpf/Pdf-Viewer/enabling-and-disabling-notification-bar">Enable and Disable Notification bar</a></li>
<li><a href="/wpf/Pdf-Viewer/how-to/Disable-the-Undo-Redo-operation">Disable the Undo Redo operation</a></li>
<li><a href="/wpf/Pdf-Viewer/how-to/Unload-the-document">Unload the document</a></li>
<li><a href="/wpf/Pdf-Viewer/how-to/Check-the-loaded-document-is-edited">Check the loaded document is edited</a></li>
</ul>
</li>
</ul>
Expand Down
41 changes: 41 additions & 0 deletions wpf/Pdf-Viewer/How-To/Check-the-loaded-document-is-edited.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: post
title: Check the loaded document is edited in PdfViewer | Syncfusion<sup>&reg;</sup>;
description: Learn about how to Check the loaded document is edited in Syncfusion<sup>&reg;</sup>; WPF Pdf Viewer control using IsDocumentEdited property.
platform: wpf
control: PDF Viewer
documentation: ug
---

# Check the loaded document is edited or not

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](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_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.


{% tabs %}
{% highlight c# %}

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);
}
}
{% endhighlight %}
{% endtabs %}