Adobe PDF Reader Plugin in TWEBBROWSER on new PC - delphi

according to PDF in TWEbbrowser I tried to run an selfprogrammed Delphi Prg which displays the PDF in a TWEBBROWSER component fine. But on 2 new PCs, where I just installed the Adobe DC PDF Reader I only see a gray window - no PDF anymore. How to fix this? I can see the PDF in IE. I Have Delphi Berlin.
Thanks for help

The reason why PFD isn't correctly shown in TWebBrowser is the fact that by default TWebBrowser is opening web pages in Compatibility mode. This means that the web pages are opened in Interent Explorer 7 mode wihtout any extensions. And in order for you to be able to open PDF in Internet explorer it is done so in Acrobar Reader Web Extension.
In order to make TWebBrowser open web pages in compatibility mode for newest IE version you need to Opt in to the browser emulation feature using the documented registry key
NOTE: You need to opt in to the browser emulation on every computer where your program is used.
Or you could switch to the use of TEdgeBrowser instead as Robson Benedito suggested in his answer.

TWebBrowser component, when in Windows, navigates using the old Internet Explorer (not Microsoft Edge).
To ensure that it works you should open Microsoft Internet explorer and try to open this document in the machine that is showing the problem.
If it doesn't open you should fix it inside IE before open in you Delphi app. If it does, it could be an incompatibility with this Adobe plugin and the engine provided/used by TWebBrowser. In this case you can switch to TEdgeBrowser component that provides you the ability to have you own browser (with Chromnium) even if the Microsoft Edge is not installed (http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component).
With TEdgeBrowser you can open PDF directly without using plugin (even those installed in Windows).
Using TWebBrowser can also lead you to others problems with others PCs depending on the Internet Explorer (like proxy/javascript/plugins/etc).

Related

Delphi OpenPictureDialog behave different on different app

I'm using Delphi 10.1 on Windows 10
When I run the OpenPictureDialog.Execute command
on some app it's open File Explorer with a preview area and on others without.
I have exactly the same properties on both cases.
What can cause the difference?
Thanks Sorin
function GetOpenFileName; external commdlg32 name 'GetOpenFileNameA';
function GetOpenFileNameA; external commdlg32 name 'GetOpenFileNameA';
function GetOpenFileNameW; external commdlg32 name 'GetOpenFileNameW';
In older versions on Delphi it used a Windows API function in comdlg32.dll to open a file. I would think it is the same in newer versions. What you see in terms of preview etc. is down to Windows settings.
The dialog shows to the user will be consistent with other file open dialogs they see on their system.

How to read page source TWebBrowser Firemonkey

How can I read source of the open page in TWebBrowser in firemonkey (RadStudio XE7 - Firemonkey for Android)
In VCL I simply used WebBrowser1.document but in firemonkey it has an error
TWebBrowser does not contain a member named document
How can I fix that?
The sad answer is that you can't access the source code of a webpage directly from the TWebBrowser. You can't access it because the TWebBrowser in FireMonkey is cross-platform and that means it must work on all platforms. Android and iOS does not support and allow this, which means the Windows Desktop version of TWebBrowser can't allow this either.
You will have to use a different component to do this, probably a third party component.
I am not sure if this will help you or not, but here is a link to something that might help: http://firemonkeylessons.blogspot.tw/2015/01/get-htmljson-from-twebbrowser.html

IWebBrowserDisp ole2 interface cannot open IE window to front of the screen

With Windows 7/8, this very nice ole2 interface IWebBrowserDisp is no more working properly, for some reason it now opens the IExplorer Window behind the actual currently running delphi application, not to the front of the screen as it used to be work earlier.
This makes the application to fail as user cannot see the opening web page without manually switching to Iexplorer and locating the correct window.
The code that I use to launch the link is:
WB : TEmbeddedWB;
wb.Navigate(URL,x,x,x,x);
This problem does not exist in older Windows or while I use my Delphi IDE ( I use Delphi4 and run it as ADMIN).

Is there a version of Synactis' TPDFViewer in Delphi XE

I have used the Synactis product PDF-in-the-box in Delphi 2006 projects and also a free component they had called TPDFViewer, which allows you to embed a PDF viewer in your application.
I am porting one app to XE and - having found that trying to install the TPDFViewer I had in XE did some serious damage to my installation - I'm looking for a replacement.
I have installed XE-supported trial versions of their current offerings PDF-in-the-box 4.04 and All-in-the-box 4.04 but can't see any sign of the TPdfViewer component in either. Their website FAQ implies this functionality has been replaced by functions to start Adobe Reader.
So I want a (free would be nice, but not essential) PDF viewer for Delphi XE which doesn't just chain to Adobe Reader and allows user interaction or programmatic control over zoom, page number etc.
I tried several times to find a good PDF viewer. Most of them were fake components. The best way is to embed acrobat reader dll directly into your application and command it from there.
It was 8 years ago, so I do not remember the code that I used to do this. You import the acroXX.dll file directly into Delphi, it prepares a user component for you and then you install this component directly in to your Component palette.
The worst thing in this configuration is that you have to take care of the acrobat reader dll that is installed on your clients. Any update/upgrade of the reader may cause your application to fail.

File Does Not Begin With '%PDF-'

I had a peculiar problem yesterday. A customer put one of my Delphi apps on some Toshiba laptops, and all was fine until it was time to generate some Acrobat files as a Rave 7 report, which produced the subject error.
The laptops had Acrobat 7 Standard installed with XP SP3 and IE8. I uninstalled Acrobat 7 Standard, put in Acrobat 5 Reader which they had lying around, and the problem went away. However, the customer doesn't see backtracking Acrobat as a solution, because the usual environment this Delphi app runs in of XP SP3, IE 7, and Acrobat 7 Standard doesn't show this problem.
A Google search didn't reveal any recent causes or effects. The Microsoft and Adobe KBs deny that any problem exists.
Any clues as to what specific area needs a workaround? Today I'm going to uninstall IE8 and reinstall IE7.
I came a cross the same problem, in IE with the Adobe ActiveX plug-in. It was some time ago, but if I remember correctly the problem was the ActiveX in some versions of Acrobat 7, maybe combined with specific versions of the PDF itself. Installing the latest Adobe Reader solved the problem.
If reinstalling Firefox (or your browser) and reinstalling Adobe Acrobat Reader does not work is because it is inheriting settings from past versions. What worked for me is doing a manual uninstall of all stored application data. In Win 7 Go to C:/users/your name/AppData/Roaming/Mozilla or Microsoft/ and the try to delete all of the content related to your browser including extensions and plugins. If you don't have permission to delete folders then open it and delete file by file.
Note that you have to be able to view hidden files to access AppData folder. Then do the same for the AppData under Adobe folder. Then reinstall Firefox and acrobat reader. Done!
PDF files are suppose to start with the sequence "%PDF-X.Y"; however, some programs, email programs are notorious, will add a header, such as Mac Binary. Acrobat looks in the first 1024 bytes for the %PDF sequence. Other applications only support %PDF at the beginning of the file.
We were experiencing this and found that it was a matter of adding the site to the "allowed popups" list.

Resources