1. Arthur Hefti
  2. PowerBuilder
  3. Thursday, 12 August 2021 05:44 AM UTC

Hi

I have a strange behaviour in the WebBrowser control. When I download a PDF or an Excel from a site the page turns blank and there's no way to show the content again. I need to restart the browser. When I call PrintAsPDF() the PDF shows the content of the page.

I did the test with the WebBrowser Demo by Bruce as well with the same behaviour.

When I use the original cefclient.exe sample it works fine.

Any idea?

Regards
Arthur

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 16 August 2021 13:02 PM UTC
  2. PowerBuilder
  3. # 1

Hi Arthur,

I found it very helpful to use the following code in the Open() event of the application ( I was recommended to do that by Appeon Support) (it has to be in the open of the application object):

// v3, mjl, 18/06/21: seems to be a necessary setting for CEF webbrowser control:
int li_ret
string ls_ret
li_ret = WebBrowserGet("UserAgent", ref ls_ret)
if ls_ret = "" then
	li_ret = WebBrowserSet("UserAgent", "AppeonWebBrowser")
	if li_ret <> 1 then
		Messagebox("Information", "Error setting the UserAgent for the WebBrowser", information!)
	end if
end if
// v4, mjl, 05/07/21: avoid an existing Appeon bug of blowing up when using the webbrowser control on Windows Server 2012 R2:
open(w_wbrowser_dummy)
close(w_wbrowser_dummy)

string ls_docFolder
n_filesys lnf
ls_docFolder = lnf.of_getfolderpath(CSIDL_PERSONAL)

li_ret = WebBrowserSet("DownloadPath", ls_docFolder)
if li_ret <> 1 then
	Messagebox("Information", "Error setting the DownloadPath for the WebBrowser", information!)
end if
li_ret = WebBrowserSet("allow-file-access-from-files", "true")
if li_ret <> 1 then
	Messagebox("Information", "Error setting the FileAccess for the WebBrowser", information!)
end if

 

The w_wbrowser_dummy is a tiny child window with the visible attribute un-checked. (so invisible). Opening it and closing it avoids a blow-up on Windows Server 2012, when exiting the application (no problem on 2016).

Hope it might help your problem. If it doesn't, I'd think of when opening or saving a pdf file, you probably are changing the internal current directory to be set to anything else the where your application resides. Depending on if you use a runtime install or relative path to where the runtime dlls are, this might maybe cause the Cef folder no  longer being found.

regards.

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 12 August 2021 05:54 AM UTC
  2. PowerBuilder
  3. # 2

Hi Arthur, Can you open a support ticket and provide test case so we can make sure it is not a bug?

Comment
  1. Arthur Hefti
  2. Friday, 13 August 2021 10:51 AM UTC
Hi Armeen

I check out how we can provide a sample.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 13 August 2021 16:11 PM UTC
Thank you very much.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.