Solved

SHOW PDF FILE AT WINDOWS FORM

Posted on 2011-02-13
16
655 Views
Last Modified: 2012-05-11
Hi All,

I want to show pdf file at windows form.

How could I do it ?

Thank you.

0
Comment
Question by:emi_sastra
  • 8
  • 4
  • 4
16 Comments
 

Expert Comment

by:botweb
ID: 34882558
The easy way:

Try WebBrowser control.

Let us say you put an unbound object frame to a form. Then in the form module the following code will populate the control.

 
Me.acxWebBrowser.Object.Navigate <path to pdf file>

Open in new window

0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34882583
Hi botweb,

Where acxWebBrowser is came from ?

Thank you.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34882619
There is no object property for WebBrowser.

  Me.WebBrowser1.ObjectForScripting.Navigate(sender.tag)

Runtime error : Object variable or With block variable not set.

Thank you.
0
Industry Leaders: 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!

 

Expert Comment

by:botweb
ID: 34882673
Here you can get around using the Webbrowser in VB:
http://www.instructables.com/id/Make-a-web-browser-in-visual-basic/
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34882738
I can't see how to show pdf file ?

Thank you.
0
 

Expert Comment

by:botweb
ID: 34882754
Oh, you simple let the Browser view a PDF file. Like the Browser is doing when you adress to a PDF file.
So just adress the Browser component to a PDF file like file://C:\File.pdf
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34882786
How to code it ?

My code and your code failed to do so ?

Thank you.
0
 

Expert Comment

by:botweb
ID: 34882811
Simply follow here http://www.instructables.com/id/Make-a-web-browser-in-visual-basic/ to get to know the Webbrowser component and how to use it.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34882863
Please see below code.

     AddHandler btn.MouseClick, AddressOf Show_Pdf_File_With_Web_Browser

 Private Sub Show_Pdf_File_With_Web_Browser(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Try
            'Dim WebBrowser1 As New WebBrowser
            WebBrowser1.Navigate(sender.tag)
        Catch ex As Exception
        End Try

    End Sub

It works for the first sender but not others sender.

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34883869
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34887083
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34887189
What do you think ?

I should add about 7 dll, compare to a singe Acrobat Library without installing acrobat reader ?

Thank you.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34887221
If that single library suits you, what are you still looking for?
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34887250
Just curious about it, since someone here introduce it and I am a learning guy.

I was wrong, should install adobe reader in order to use it.

Thank you.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 34887260
I think I will close this question.

Your link http://www.codeproject.com/KB/applications/PDFViewerControl.aspx could help me learn it.

Thank you very much for your help.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34887699
Glad to help :-)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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