Solved

vb.net WebBrowser1 Question

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Name Space error VS2015 1 47
Find date of 2nd Thursday of each month 3 44
Check only one toolstripmenu item 12 57
Adding Rows to Grid 4 28
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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