Solved

vb.net WebBrowser1 Question

Posted on 2013-06-17
4
323 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

690 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