Windows 11 and Browser Control
Steven Burrows
Testing XPA 4.7 under Windows 11 looks good with a few GUI changes that seem improvements to me. The only issue we have found is when we try and display a PDF with the XPA Browser Control we get “Navigation to the webpage was canceled” as if the file name is wrong (don’t think it is)
Pasting the PDF file name into Edge displays correctly.
Any ideas ?
(I cant do too much investigation, just using Hyper-V to run a test environment, cant really use Studio on it quite yet) Steven Burrows
|
|
Todd Baremore
Steven,
toggle quoted message
Show quoted text
Try using a .NET browser System.Windows.Forms.WebBrowser There is no change in behavior in Windows 11 that I have found so far. I believe the browser control was based upon Internet Explorer which is no longer a part of Windows 11. I could be wrong about this. Todd On 11/1/2021 5:04 AM, Steven Burrows
wrote:
|
|
Steven Burrows
Thanks, Tried that, same result. One thing I missed is that (both methods) ask to open/save the PDF file.
Steven Burrows
From: main@magicu-l.groups.io <main@magicu-l.groups.io>
On Behalf Of Todd Baremore via groups.io
Sent: 01 November 2021 12:45 To: main@magicu-l.groups.io Subject: Re: [magicu-l] Windows 11 and Browser Control
Steven, Todd On 11/1/2021 5:04 AM, Steven Burrows wrote:
|
|
Todd Baremore
You may need to load the PDF in to a BLOB and use
toggle quoted message
Show quoted text
DNSet(PM.DocumentText,Trim(PL)) DNSet(v Browser.DocumentText,Trim(v html page BLOB)) In your case PL would contain the pdf file. Todd On 11/1/2021 10:19 AM, Steven Burrows
wrote:
|
|
Steven Burrows
Thanks, tried : v Blob = File2Blb(v File) DNSET (v Browser.DocumentText, TRIM(v Blob))
And get a page of raw PDF. Am I missing an intermediate step to embed the PDF in some HTML ?
Steven Burrows
From: main@magicu-l.groups.io <main@magicu-l.groups.io>
On Behalf Of Todd Baremore via groups.io
Sent: 01 November 2021 14:30 To: main@magicu-l.groups.io Subject: Re: [magicu-l] Windows 11 and Browser Control
You may need to load the PDF in to a BLOB and use Todd On 11/1/2021 10:19 AM, Steven Burrows wrote:
|
|
Todd Baremore
Steven,
toggle quoted message
Show quoted text
You may need to invest in something like: https://www.e-iceblue.com/Introduce/free-pdf-viewer-net.html I open pdfs in the default application. The security for Content Copying and Changes are set to "No" Todd On 11/1/2021 11:59 AM, Steven Burrows
wrote:
|
|
Brendan Wheeler
Did anyone ever find a solution to the below? We store pdfs as blobs in the database. It would be great to view them in the .net browser without having first fo Blb2file to create a physical pdf. v Blob = File2Blb(v File) DNSET (v Browser.DocumentText, TRIM(v Blob))
And get a page of raw PDF. Am I missing an intermediate step to embed the PDF in some HTML ?
Steven Burrows |
|
Steven Burrows
I gave up on the premise that I did not see how the browser control would have any way of identifying the file format (correctly or incorrectly, but it was a reason) We now do a Blob to File into the OS Temp area with a GUID as the filename and let Windows tidy it up whenever it likes
Steven Burrows
From: main@magicu-l.groups.io <main@magicu-l.groups.io>
On Behalf Of Brendan Wheeler via groups.io
Sent: 09 September 2022 13:07 To: main@magicu-l.groups.io Subject: Re: [magicu-l] Windows 11 and Browser Control
Did anyone ever find a solution to the below? We store pdfs as blobs in the database. It would be great to view them in the .net browser without having first fo Blb2file to create a physical pdf. v Blob = File2Blb(v File) DNSET (v Browser.DocumentText, TRIM(v Blob))
And get a page of raw PDF. Am I missing an intermediate step to embed the PDF in some HTML ?
Steven Burrows |
|
Brendan Wheeler
Hi Steve,
Thanks for answering. Yes thats what we do, but when the user is moving between records in a table it is quite slow, due to having to keep creating these tempfiles. It seems to me that there should be a way to tell the .net browser that the blob is a PDF. But I can't find one. |
|
Todd Baremore
Brendan,
toggle quoted message
Show quoted text
The XPA 4.8 browser control has no trouble displaying a pdf. In 4.8 the browser control is Chromium, not the old IE control. You should be able to use BrowserSetContent( ). Todd On 9/9/2022 8:21 AM, Brendan Wheeler
wrote:
Hi Steve, |
|
Brendan Wheeler
Hi Todd, thank you for the suggestion.
However using the 4.8 browser control if I pass the blob directly to the browser using BrowserSetContent( ) I still get a page of raw data. The browser does not recognise it as a pdf unless I use Blb2File() to first create physical pdf.. |
|
Steven Burrows
Not here on 4.8.1, that just displays the PDF as a Unicode/Ascii string
Worse – While testing this, I discovered that our “foolproof” method of copying to OSTemp doesn’t work on a new RDP Server, that just shows blank. …getting rather frustrated – Time for a cup of Tea Steven Burrows
From: main@magicu-l.groups.io <main@magicu-l.groups.io>
On Behalf Of Todd Baremore via groups.io
Sent: 09 September 2022 13:58 To: main@magicu-l.groups.io Subject: Re: [magicu-l] Windows 11 and Browser Control
Brendan, Todd On 9/9/2022 8:21 AM, Brendan Wheeler wrote:
|
|
Todd Baremore
Brendan & Steve,
toggle quoted message
Show quoted text
Apologies for not RTFMing before the post. "BrowserSetContent Sets the content displayed in a Browser Control with a new html text. " There should be a way to do this using javascript and BrowserScriptExecute(). Off the top of my head, create a generic html page with a javascript function that accepts a single BLOB parameter. The type will need to be set similar to type:'application/pdf' ....20 minutes later..... See this example: var blob = new Blob([pdfBuffer], {type: 'application/pdf'}); var blobURL = URL.createObjectURL(blob); window.open(blobURL); https://stackoverflow.com/questions/53066089/how-to-open-pdf-blob-using-browsers-pdf-viewer-rather-than-downloading This would be a good Brown Bag session. Todd On 9/12/2022 4:56 AM, Brendan Wheeler
wrote:
Hi Todd, thank you for the suggestion. |
|
Steven Burrows
Thanks, gave it a try, but still have blank control, although it’s quite likely to be me not really having a clue (I didn’t even have Microsoft.mshtml in my CRR)
The js looks good and BrowserScriptExecute returns TRUE, so I must be doing something right.
If anyone gets an XPA example working that can display a pdf blob, it would be appreciated
Steven Burrows
From: main@magicu-l.groups.io <main@magicu-l.groups.io>
On Behalf Of Todd Baremore via groups.io
Sent: 12 September 2022 13:50 To: main@magicu-l.groups.io Subject: Re: [magicu-l] Windows 11 and Browser Control
This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email.
Brendan & Steve, On 9/12/2022 4:56 AM, Brendan Wheeler wrote:
|
|