Friday, June 22, 2007 10:16 AM
How i can open pdf file in vb.net applicatin?
Friday, June 22, 2007 7:37 PMThe quick and easy way to do this is to use the web browser control. This assumes that both IE and the Acrobat Reader are installed on the target system. Just use the Navigate method of the control with the PDF filename as the parameter and you're there.
Saturday, June 23, 2007 4:42 AM
Here is another way to read pdfs.
Right click on any of the tabs in your toolbox and click choose items.(Just make sure you have a version of adobe reader installed before starting.) When the dialog box pops up click the 'com components' tab then pick tha 'adobe pdf reader' com component. Click ok and you should now see a 'adobe pdf reader' control in your toolbox. Click this and drag it to your vb form.(you may need to resize it, usually appears very small). Now in order to read any pdf just alter the 'src' property of the control either in code or in the designer. when you run the program you should be able to view the pdf doc in the vb form with most of the options you get in adobe reader. Here is how you would alter the 'src' property in code.Code Snippet
AdobeReader.src ="C:\mydoc.pdf" End Sub
Hope this helps
Friday, June 29, 2007 4:24 PMI just tried to do this in an ASP.NET 2.0 application and after selecting Adobe PDF Reader from the COM components list, it came to the toolbox as disabled. I don't seem to be able to drag it onto the project.
Is there some other setup needed? I do have adobe reader installed on my machine, and it comes up in a regular web browser whenever I load a pdf. I've tried adding project references to the adobe dll's but this doesn't seem to make a difference either.
Thanks in advance,
Friday, July 06, 2007 7:17 AM
Hi there Anye,
the method i talked about earlier is for reading a pdf file within a vb.net windows application and not asp.net 2.0. To read a pdf in asp.net 2.0 just point a hyperlink straight to the pdf file and it should just open it within the browser no questions asked (provided you have adobe installed). Hope this helps
Monday, August 27, 2007 10:15 PM
Tuesday, January 01, 2008 1:38 PM
I attempted to load this file after following the steps you provided, and I get an error stating that AdobeReader is not declared. I am new to VB and do not know the proper steps to achieve viewing a .pdf file from a visual basic application. PLEASE HELP. THANK YOU
Saturday, January 12, 2008 7:14 AM
When I am running @ the command prompt of window the pdf (or any extention of) file name , it search the respective program and run. I am using Powerbuilder 10, I need to know any API call that make me enable to do that with in the code (if i am going to mention the program name i.e. Run ("acrobat.exe profile.pdf") it will run. But the problem is file could be text , jpg , bmp , or any user define file.....
Thanks in Advance
Monday, January 14, 2008 11:00 AMhey Vince,
'AdobeReader' was the name of the control that reads the pdf file. You dont have to call it 'AdobeReader' that's why it's being flagged as not declared. In the space of 'AdobeReader' put the name of the Adobe control that you drag from the tool box.
Thursday, January 24, 2008 2:52 PM
This is great. But now I want to DEPLOY and the dang reader comes up blank when I run the program from an install of the .exe. Do I need to do something special in by build do get the reader to deploy with the software? The form displays with a blank box where the reader should be, and when I invoke a pdf to load (click a button) I get nothing.
Thursday, July 10, 2008 2:28 PM
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
THANKS A TON! This worked like a dream! Just remember to rename the adobe object to AdobeReader or replace AdobeReader with whatever name you selected. I took this further with an OpenFileDialog and ended up just putting
this in as my code:
Now now to get the adobe object size to adjust to screen sizes.
Saturday, August 23, 2008 2:59 PM" Now now to get the adobe object size to adjust to screen sizes."
Could you just set the dock to fill on the AdobeReader, and the make the window state maximized?
Wednesday, December 31, 2008 11:04 PMPrivate Sub frmMain_Resize(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles Me.Resize
pdfOutput.Size = Me.Size
This is what I used when I resized my viewer.
Monday, January 19, 2009 7:49 PMWhen I follow your instructions and add the adobe control, it appears in the toolbox, but is greyed out.
Am I missing something ? I have confirmed that the Acrobat reader is installed.
Tuesday, January 27, 2009 3:27 PM
When I used the hyperlink method, I was prompted to Open or Save the PDF. Is there a way around this window ??
Sunday, April 26, 2009 9:05 PMIs it possible to use this control in such a way that the PDF is saved in the resources folder or some other application folder? Can you open it from an self contained application folder rather than a folder on the user's computer?
Wednesday, September 29, 2010 4:01 PM
Use the following statment:
Sunday, November 28, 2010 1:06 PM
I tried this method but at runtime I get an exception stating that the class is not registered. Im using Visual Studio 2008. Plz help me
Tuesday, November 08, 2011 2:46 PMThanks A Ton .. It Is really helpful.. it is working.. thank you so much Button event then add WebBrowser from the tool box.. Apply this coding on the button Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Process.Start("D:\book.pdf") ' Approach 1 WebBrowser1.Navigate("D:\book.pdf") ' Approach 2 AdobeReader.src = "D:\book.pdf" ' Approach 3: Add Reference to COM component: Adobe pdf Reader End Sub
Monday, November 21, 2011 3:24 PM
I am also tryign this...tryign to add the Adobe PDF reader control...it comes in but its grayed out WHY?
How do I endable the control in my toolbox?
Wednesday, August 08, 2012 9:47 AM
Is there any way to show the pdf documents in the windows forms application with out depending IE and the Acrobat Reader installed on the target system, because when the client machines gets updated either for the OS or Adobe Acrobat currently the application is not working as expected, so I need to have this feature implementation with out using these two components IE and Acrobat Reader
Thursday, March 07, 2013 3:49 PM
This is great info but in VS2012 the Adobe PDF Reader control is grayed out and cannot be dragged over into an aspx or vb file. Is there a way to enable it?
Thanks in advance!