philip
Member
- Joined
- Mar 23, 2024
- Messages
- 6
- Programming Experience
- 1-3
Hi good day! I'm displaying a pdf from local machine using webView2 from Microsoft.Web.WebView2 by Microsoft installed through Nuget Packages. Now I'm really confused should I manually dispose webView2? but it says that webView2 is managed resource base on chatGPT. I just want to make sure that the value put in the webView.Source is clean/managed when pdf is no longer displayed. Thanks in advance.
Initialize webView.Source to pdf file in local machine:
try {
webView.Source = new Uri(tempFilePath); // set the source of webView to the temp pdf path
webView.Visible = true; // set the webView to visible
//Path of temporary file for search result
MessageBox.Show(tempFilePath, "PDF INVENTORY TRIAL search funct", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "PDF INVENTORY TRIAL search funct", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Last edited: