Solved

vb.net WebBrowser1 Question

Posted on 2013-06-17
4
321 Views
Last Modified: 2013-06-20
Hello

I need to disable the text selection when I open a PDF File with WebBrowser Object.

current code:
Dim fileurl1 As New Uri(filelocation & "#toolbar=0&navpanes=0")
WebBrowser1.Navigate(fileurl1)

Any Ideas would be great
Thanks
0
Comment
Question by:HelpdeskJBC
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39253170
It's not the WebBrowser control that would be handling this; it's the Adobe Reader plugin. I don't believe there are any options in the open parameters offered by the Reader plugin (see attached file) that would grant you this functionality.
PDFOpenParameters.pdf
0
 
LVL 15

Expert Comment

by:Minh Võ Công
ID: 39253472
http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/c6fc24d7-6def-40ca-bc37-628d78caa91d

use javascript
<script language="JavaScript1.2">

function disabletext(e){
return false
}

function reEnable(){
return true
}

//if the browser is IE4+
document.onselectstart=new Function ("return false")

//if the browser is NS6
if (window.sidebar){
document.onmousedown=disabletext
document.onclick=reEnable
}
</script>
http://support.microsoft.com/kb/318086
or
http://stackoverflow.com/questions/1856784/disallow-text-selection-in-net-webbrowser
0
 

Author Comment

by:HelpdeskJBC
ID: 39255366
I've tried the first link and right clicking on the WebBrowser1 is now disallowed, but there is still a way to select text and ctrl+C copy it.


I'm not able to figure out how to implement your other 2 links
Could you try to create a small sample Program which is opening an pdf file under c:\
in webbrowser1? that would be great.

Thanks
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39262731
That's because minhvc's code applies to HTML in the browser. As I said, the browser doesn't control the PDF; it only loads Adobe Reader. Adobe reader controls whether or not you can select text.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question