AcroPDF viewer control problems - c#

I'm at the point of giving up.
I need to view pdfs in my Winforms application, so I've tried using Adobe's ActiveX control, and the vanilla WebBrowser control. The pdfs are local, and can be opened from Explorer with no problems at all.
The weird thing is that the application views the pdfs fine when running in Visual Studio, but the built application simply shows a grey area where the pdf is supposed to be. The exact same thing happens with both the Adobe control and the WebBrowser control. After a while, I usually get an Adobe error saying There is a problem with Adobe Acrobat/Reader. If it is running, please exit and try again. (103:103). I've looked this error up, which advised me to do things that didn't work (turning off a security setting).
Moreover, if the WebBrowser control is called with a .Navigate(path, true), the application opens an IE window that displays the pdf just fine.
I've tried running as administrator, which makes no difference. I'm at wits' end, so any help would be greatly appreciated. Maybe going for a 3rd party control?
Some further detail: I tried both Adobe 11 and Adobe DC, on Windows 10 and 8.1 VMs, .Net 4.6. Only a Win7 VM seems to work fine.

I solved this by building to x86 targets. Apparently AcroPDF.dll doesn't support x64. Of course, the error messages weren't at all helpful.
My previous answer was incorrect. The real issue is Adobe's Protected Startup mode. This has to be turned off for the application to use the viewer directly without problems.

Related

After Win10 June 21 update, winform webcontrol with Adobe not working anymore

I am using in my Winform appplication (VB, C#) the onboard webcontrol for displaying .pdf documents. Not the optimal solution, but worked fine so far. On the PC, Adobe reader DC is installed.
After the June update on both of my develpment PC's, the Adobe 'Plugin' inside Webcontrol not working anymore. On document load (navigate), it pretends to load but nothing coming up. In addition, with every call, the Adobe services are "hanging" in the task manager. Usually, if I closed my app, all instances disappear. Not anymore now.
I know, the topic was asked over and over again - but is there a simple, easy to use control for Dotnet available which I could use instead of webcontrol/Adobe to display pdf's?
Btw, I tried to deinstall the update. 1st attempt was working, second failed. So this is not the solution

WebView2 control unable to render html

I'm testing WebView2 (1.0.774.44) to see if it can replace old IE embedded web browser for my wpf project. What I'm doing is simply navigate to wherever the domain I hardcoded. And it works fine on my Dev environment. But when I test my app (the same .exe) on one of my virtual machines, it does not work.
On the testing environment, the web viewer only displays blank pages. When I run DevTools on the page, it looks like it loads html strings. I can even click links or buttons on the page. I just cannot see them.
There are not much to share either. I just simply made a new window that is declared like below.
//TestWebViewWindow.xaml
<window
...some declarations
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
...more declarations
>
<Border>
<wv2:WebView2 Name="xWebView" Source="https://microsoft.com">
<wv2:WebView2.CreationProperties>
<wv2:CoreWebView2CreationProperties UserDataFolder="C:\Temp\webview2"/>
</wv2:WebView2.CreationProperties>
</wv2:WebView2>
</Border>
</window>
At first, I thought it was a browser problem but then the problem persisted on my testing VM, even when I installed the latest compatible Webview2 Runtime.
Both of my testing and dev environment have WebView2 Runtime (89.0.774.68) installed. And I have copied WebView2Loader.dll on the testing environment.
Any guidance?
EDIT: I have not tried Disabling one of Display adapter, but unfortunately, that option is not a way I'm trying to pursue. What I found so far is that, stated problem does not seem to reproduce on latest release of Windows 10.
We experienced a similar issue and finally discovered that it could reproduce only whenever we worked with more than one graphics card adapter. Perhaps it's also your case.
The same problem here,
Finally I found a solution by disabling one of my display adapters and changing the main display in Windows settings.
As a less aggressive method, you can also try to change the main monitor on Windows
It's completely odd but it's working now.

C# Web Browser Control - Make it Just Like IE

My WinForms project involves a C# web browser control - and I am getting the dreaded scripting error (like this image, different error though) when I visit different webpages:
I have read, and done, all the stuff about updating the browser emulation mode from IE7 to IE9 (or 11) in the windows registry (a la this stuff Use latest version of Internet Explorer in the webbrowser control) and the error still persists.
Now this is really frustrating due to the fact the the web page I am visiting works fine in IE itself, it is just my embedded one that has the error.
In desperation, I renamed my generated exe file "iexplore.exe" and bingo, the app works, with no scripting errors.
So this tells me there must be other settings in the registry or somewhere that cause this error, if anyone knows what these are I'd be most grateful if you could share them please!
N.B. I don't want to suppress the errors, I want to run the script.
Set the WebBrowser.ScriptErrorsSuppressed property to true disable the alerts for errors. Documentation here.
You can also change the IE version used by your WebBrowser as seen here, though I recommend doing this in the installer as editing the registry requires admin permissions.
I would also recommend navigating to http://detectmybrowser.com/ from your WinForms browser to make sure that the changes you made to your registry are correct.

Hard Error for password box on Windows Standard Embedded 7

I am working on a C# application for a Windows Standard Embedded 7 platform. I have managed to create a Windows image (using Image Configuration Editor) and installed the .NET 4.5 runtime, as well as the application software. All good so far.
When I run the program, all looks well - the hardware initializes correctly and the software loads its data. However, when I go to the program's "login" dialog (an otherwise ordinary WPF dialog window that gives access to extended functionality), something odd happens. The dialog has a PasswordBox in it, and when I click (or tab focus) to that box, the software crashes with a system message box saying "Unknown Hard Error". There's no real clue as to why this happens, and it is 100% repeatable. Any ideas? Any ideas on how to diagnose the problem?
This turns out to be a problem with fonts (!). You need to include TrueType fonts in the Image Configuration Editor when building an IBW image for Windows Standard Embedded 7, it will NOT get picked up as a dependency in the .NET 4.x template.

Using a Sony ActiveX / OCX Control in a Windows Form - works in design time, not in debug/run

Visual Studio 2010 pro, .NET 4.0 w/ SP1. Windows 7 64-bit OS, w/SP1. x86 target application. Sony SNC-RZ50n network camera.
Using a Sony ActiveX control, I am able to view the video feed from an attached (directly to my PC via crossover ethernet cable and 2nd NIC) network camera on a form containing the ActiveX control, but only while in the design mode of Visual Studio. I activate the video feed by changing a parameter in the designer. However, once I run/debug the application, the video feed no longer displays on the control (after changing that same parameter programatically).
The control is still present on the debug/run form, and I am verifying with WireShark that the video request is still being sent, and the video data is still being returned. I can even use the Sony-provided "capture" button to display a still shot of the current video feed. It's just the video box that does not display (in debug/run mode).
Any ideas why this might be happening? I understand the design-time form I am seeing is not a true instantiation of my form, but of the base class. The base is the same as this form, so there should be no gotchas there.
Here is a screenshot of design mode:
and run/debug mode, including what is seen after you click "capture":
I have put in a support request with Sony, but they are less than prompt in supporting this >6-year-old API. This control is poorly documented, as you can imagine. Thank you in advance.
So until Sony decides to provide technical support for this issue, I have used a work-around of embedding their activeX viewer object in an html page, which I have then embedded in a form (via web browser panel) in my application. I will update this post again if Sony ever gets back to me.

Categories