Solved

vb.net WebBrowser1 Question

Posted on 2013-06-17
4
316 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 74

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 74

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now