I was wondering if a i can remove the buttons in the red box .. check the link below
Form image : i can't add images yet
I want to disable the "save" and "print" function
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PdfViewer
{
public partial class Form1 : Form
{
public Task App { get; set; }
public Form1()
{
InitializeComponent();
InitializeWebView();
}
private void InitializeWebView()
{
App = webView21.EnsureCoreWebView2Async(null);
}
private async void Form1_Load(object sender, EventArgs e)
{
await App;
webView21.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
if (webView21 != null && webView21.CoreWebView2 != null)
{
webView21.CoreWebView2.Navigate(@"C:\sample.pdf");
}
}
private void button1_Click(object sender, EventArgs e)
{
webView21.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
if (webView21 != null && webView21.CoreWebView2 != null)
{
webView21.CoreWebView2.Navigate(addressBar.Text);
}
}
}
}
We have a prerelease API to hide buttons in the PDF view. You can see it in the CoreWebView2Settings.HiddenPdfToolbarItems documentation.
this.webview2.CoreWebView2.Settings.HiddenPdfToolbarItems =
CoreWebView2PdfToolbarItems.Save |
CoreWebView2PdfToolbarItems.SaveAs |
CoreWebView2PdfToolbarItems.Print;