Skip to content

Commit 60f318f

Browse files
authored
Merge pull request #1538 from syncfusion-content/905578_hotfix
Update the Ug about canceling save in save events in WPF PdfViewer
2 parents 2030140 + e76b45d commit 60f318f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

wpf/Pdf-Viewer/Saving-the-PDF-document.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,35 @@ namespace SaveEvents
7575
{% endhighlight %}
7676
{% endtabs %}
7777

78+
### Canceling save in Save events
79+
80+
The [BeginSave](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_BeginSave) event occurs before initiating the save operation of the PDF file. It also allows you to cancel the save operation using the [Cancel](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.BeginSaveEventArgs.html#Syncfusion_Windows_PdfViewer_BeginSaveEventArgs_Cancel) property of [BeginSaveEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.BeginSaveEventArgs.html). The following code shows how to wire the event in the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html).
81+
82+
{% tabs %}
83+
{% highlight c# %}
84+
85+
public MainWindow()
86+
{
87+
InitializeComponent();
88+
// Wire the `BeginSave` event.
89+
PdfViewer.BeginSave += PdfViewer_BeginSave;
90+
// Load the PDF file
91+
PdfViewer.Load("../../Data/Windows Store Apps Succinctly.pdf");
92+
}
93+
94+
#region Events
95+
private void PdfViewer_BeginSave(object sender, BeginSaveEventArgs e)
96+
{
97+
// Insert your code here
98+
99+
// Cancel the save operation
100+
e.Cancel = true;
101+
}
102+
#endregion
103+
104+
{% endhighlight %}
105+
{% endtabs %}
106+
78107
### End Save
79108

80109
The [EndSave](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_EndSave) event occurs after the completion of the save operation. The [IsCanceled](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.EndSaveEventArgs.html#Syncfusion_Windows_PdfViewer_EndSaveEventArgs_IsCanceled) property of the [EndSaveEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.EndSaveEventArgs.html) helps you to know whether the save operation is canceled or not. The following code shows how to wire the event in the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html).

0 commit comments

Comments
 (0)