Skip to content

Whether_need_to_unload_externally_before_loading_new_document #1639

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: hotfix/hotfix-v28.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 @@ -1548,6 +1548,7 @@
<li><a href="/wpf/Pdf-Viewer/acquiring-current-page-being-displayed">Acquire current page being displayed</a></li>
<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>
</ul>
</li>
</ul>
Expand Down
36 changes: 36 additions & 0 deletions wpf/Pdf-Viewer/How-To/Unload-the-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: post
title: Unload the document in WPF Pdf Viewer | Syncfusion®
description: Learn how the Syncfusion® WPF PDF Viewer control automatically unloads the current document when loading a new one, eliminating the need for manual unloading.
platform: wpf
control: PDF Viewer
documentation: ug
---

# Unload the document in Pdf Viewer

The WPF PDF Viewer also allows a user to Unload the PDF document using [Unload()](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_Unload) API of the [PdfViewerControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html) and [PdfDocumentView](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfDocumentView.html) classes.
A user can dispose the PDF document by passing the Boolean parameter as ‘true’ to the [Unload(Boolean)](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_PdfViewer_PdfViewerControl_Unload_System_Boolean_) API. The below code illustrates how to dispose the PDF document programmatically.

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

private void UnloadButton_Click(object sender, RoutedEventArgs e)
{
//Unload the PDF document
pdfviewer.Unload(true);
}

{% endhighlight %}
{% highlight VB %}

Private Sub UnloadButton_Click(sender As Object, e As RoutedEventArgs)
'Unload the PDF document
pdfviewer.Unload(true)
End Sub

{% endhighlight %}
{% endtabs %}

N>In PdfViewerControl, it is recommended not to unload the PDF document externally when loading a new PDF document, as the control internally handles the unloading process.