Solved

vb.net WebBrowser1 Question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hide Tab Page 3 34
Set form below another form 3 35
Saveas need to save a copy 16 26
Get Client IP on RDS - VB.NET 15 27
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

16 Experts available now in Live!

Get 1:1 Help Now