Adding Adobe PDF viewer to a VB.Net Form

Posted on 2006-05-16
Medium Priority
Last Modified: 2008-02-07
The app I would like to make contains a file tree on the left side of the form and when I drill down to a PDF file, the contents of that .pdf file show up on the right side of the form.  My question is; One: Is this possible? and Two: How would I go about doing this.  I am an intermediate VB programmer and have never done anything this complicated.  Is there a website I could go to to find an open source solution of an app like the one I want?  I saw the one question that somewhat talks about this subject, but really didn't understand the solution.
Question by:Heyitsjoe80

Expert Comment

ID: 16695506
Well, I can tell you that I have searched the net left and right looking for an open source pdf reader and I had no such luck. I thought it was funny though, that were are a million examples of how to write a pdf and manipulate the pages in a pdf, but none that actually let you view the pdf. The closest thing I could find was an example on codeproject.com that makes a thumbnail of the text on the first page of the pdf file. The example was cryptic at best, so I didn't bother with it.

As for non-open source solutions, there are a few components that render pdf files, but you have to pay for them. The only thing that is free (that I have found, and technically, it's not really free) is a COM component that Acrobat Reader installs. It is a viewer for pdf files, but requires that you have Acrobat Reader installed to use it.

As I said, there are several open source projects that create them, but that's not what you want. I know because I am also looking for an open source solution to the pdf viewing problem. And this is one of those times I would like to be proven wrong when I say that there are no open source pdf viewing components that you can use in VB.NET or C#.

Expert Comment

ID: 16695774
what I did was embedded pdf to my forms and controlled what toolbars, buttons showed... I did have to pay $99 one time from adobe sdk kit....If u pay $99 a yr u will get the updates every yr.... Also if this is for a program for ur company it is the only price u pay...Pretty nice the only bad thing is u  cannot utilize some of the other cool features unless the user has the full version of acrobat. For me I just wanted to embedd and lock down some things for users that had acrobat free reader.... Worked fine for me...Not sure for you...Just a thought..

Expert Comment

ID: 16696343
Hi There,

You can try utilizing a webBrowser control if the user only needs to view the pdf file. This solution also requires that the Acrobat reader is installed in client's computer.

Drop a webBrowser control to your form. It is not in the toolbox by default so you'l have to right click the toolbox, select add/remove items, select COM components tab and scroll down until you find Microsoft Web Browser

Then you can use a simple code like,


webBrowser will act as a wrapper around PDF and display it on your form.

Hope this helps.

Technology Partners: 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!


Author Comment

ID: 16701443
Ok, Wildcard76, you answered my second question on Adobe.  Thanks, it's working great.  Now I need to create a file tree on the left so that the user can browse through a CD-Rom that has all the .pdf's.  When the user the finds the final they are looking for, I want them to click a View File button that displays the .pdf in the WebBrowser control.  That's my next leap and i'm having a hell of a time getting it to work.

Accepted Solution

wildcard76 earned 2000 total points
ID: 16706946
well there are two ways to do that...

one hard one easy...

on the hard way you can use a treeview control and populate the treeview object with node objects manually, by looking at the folder where the pdfs are... I'll need some time come up with an example...

but you can use a folderbrowserdialog to pick the file...  just drag a folderbrowserdialog to your form, and use this code when the button is clicked

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.InitialDirectory = "C:\temp"
        OpenFileDialog1.DefaultExt = ".PDF"
        OpenFileDialog1.Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*"
        OpenFileDialog1.Title = "Please Select PDF File"
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then myBrowser.Navigate(OpenFileDialog1.FileName)
    End Sub

Expert Comment

ID: 16706955
not a folderbrowser dialog, sorry...

hope this helps



Author Comment

ID: 16707990

Thanks a lot.  The easy way works for now.  I'm also looking and working on some code to make the tree view.  The app would look better with the tree view instead of just a button.  But like you said, it's really the hard way.

Expert Comment

ID: 20734860



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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 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