WinForms WebView2 not showing pdf draw tools - winforms

I have a WinForms application and a form with WebView2 control. I set Source property of the Webview2 control to a local pdf file. When I run the program, the pdfviewer is showing the pdf document, but the draw and highlight controls are not showing.
When I open the pdf in edge browser, the controls are showing. Where am I doing the mistake.

The feature to annotate PDFs is disabled in WebView2. You can read more about this on Disabling Feature: PDF Annotations Support.
Additionally, you can open a feature request to enable this feature on the WebView2 Feedback repo.

Related

Is it possible to override the some of the UI of the default Chromium PDF viewer using CefSharp?

I'm trying to implement a PDF viewer for a Xamarin.Forms WPF application, and I'm using CefSharp to load and render the PDF file. However I've been unable to perform the necessary customizations on the default Chromium PDF Viewer, or PDFium, as far as my research goes.
This is what I need to change, and the image with the corresponding items:
A - Remove the toolbar.
B - Customize the scrollbar.
C - Remove the zoom items.
D - Change the background color.
I think that the scrollbar I might be able to change on the Xamarin side of things, the other items however, I'm quite sure I'll have to deal with PDFium or Chromium.
When I open a PDF file on Google chrome, I'm able to remove the toolbar and the zoom items using some simple JavaScript. This is the source that I see when I inspect the elements of the PDF viewer on Google Chrome:
Using these JavaScript statements in the Console Window I can remove the toolbar and zoom items (but only within Google Chrome:
Remover toolbar:
document.getElementById("toolbar").remove()
Remove zoom items:
document.getElementById("zoom-toolbar").remove()
This is the custom implementation of the CefSharp RenderProcessMessageHandler that I created in order to try to get to the source and run these JavaScript instructions and customize the control as I've been able to do within the Google Chrome browser:
class PdfRenderProcessMessageHandler : IRenderProcessMessageHandler
{
// <other methods required by the interface>
// Method called when the context is created
public void OnContextCreated(IWebBrowser browserControl, IBrowser browser, IFrame frame)
{
frame.ExecuteJavaScriptAsync("document.getElementById('toolbar').remove()");
frame.ExecuteJavaScriptAsync("document.getElementById('zoom - toolbar').remove()");
frame.ViewSource(); //Display the source code
}
}
However when I call the frame.ViewSoure() method to view the source code, this is the source code that I get:
So it seems pretty obvious that the code that I have when viewing a PDF file through Google Chrome and the code that I have when viewing the same file through CefSharp ChromiumWebBrowser it's pretty different.
Am I intercepting the source code at the wrong point, how can I have access to the full source when using CefSharp? Even if I can't change the background color (based on my research), removing the toolbar, zoom items and scrollbar could solve my problem.
Does anyone know how I might be able to achieve this?
I found a solution.
In XAML just use:
src="file.pdf#toolbar=0"
And in CodeBehind use:
browser.Load(pathToFile + "#toolbar=0");

Show a Sothink menu on top of a Silverlight iFrame

I have a Sothink menu on a web page and below it is a Silverlight iframe application. Currently the iframe is covering some dropdown menu items.
I have tried solving this problem with z-indexing, windowless, and wmode. I can not change the original code of the application but when I view the source of the iframe's page, I see that the developer commented out the windowless option because it interfered with another part of the program.
The only way I have tried to insert it into my page is through this code:
<iframe src="iframe-code-url.com" frameborder="0" style="background-color:#FFF;" scrolling="yes" width="940px" height="500px" wmode="opaque" windowless="true"></iframe>
I am open to any and all suggestions. I have done a lot of research and I have not found anything.
You must set Windowless=true on the Silverlight host object, not the iFrame. If you can't access the host object, you cant enable Windowless mode and so you cant do what you want.
See here for more on Windowless Silverlight Objects
Ideally, you should host the Silverlight XAP file in the same site as your web page.

How to get selected row of ListView in web browser control in WPF

I have a web site has a ListView and navigate it by using web browser control in WPF. I want to get selected item of ListView from web browser control. I can get selected text in web browser control by using Microsoft HTML Object Library but can't do this. Is there any way to do this?
Thank you.
You can interop with the web browser control from WPF using the DLR features.

WP7 Web browser control uses IE browser, how to use different browser

I am trying for showing the content of html in web browser control. My content having encrypted value for img source. I don't what is this. That image not displaying in Webbrowser control. Also in IE browser. Normally Web browser control supports IE browser.
But it displayed for all browsers(Firefox, Chrome)
Is there way to use any(Firefox, Chorme) of the browser in Web Browser control.
Pls Help me.
Thanks
In WP7 you can only access and start standard WP7 applications, not any third party apps. So unless WP7 will be shipped with another browser, you can't do this.

winform webbrowser display pdf in same window

I have a simple question which expects a simple answer! :-)
In a visual basic .NET winform I drop a WebBrowser control
Within the form's load event script I have this:
WebBrowser1.navigate("http://www.whateverWebsite.com/WhateverDocument.pdf")
Now the issue is that the webbrowser actually launches an Adobe reader new window with the PDF document, and that window is NOT part of my application.
In my application the WebBrowser control says: Navigation Cancelled!!!!
What I want is the pdf file displayed within the actual WebBrowser control.
Any fix greatly appreciated.
Isn't this a setting in Adobe reader? Look for Display PDF in browser in settings.

Resources