Skip to main content
Participant
January 12, 2007
Question

Show PDF File in Windows Form using Visual Basic 2005

  • January 12, 2007
  • 39 replies
  • 26790 views
Hello.

I am a developer beginner in acrobat products.

I'm developing an application and I need to open one pdf file in one form with various controls, such as Text Boxes and so on, using visual basic 2005. I try to insert the Acrobat control in that form and it not works. What do I need to do to make this possible.

My configuration.

Windows XP Pro.
Visual Studio 2005 Pro.
Acrobat 7 Professional.

In the client computer I have to install Acrobat 7 Professional or I need only the Acrobat Reader?

Thanks.

Fernando Silva.

39 replies

Patrick_Leckey
Participating Frequently
July 30, 2008
> I think it may be a findcontrol command

I don't think so, because the control is still not part of the VB application, it is embedded in the HTML.
Participating Frequently
July 30, 2008
Yes, I think it may be a findcontrol command. Thanks for your time. Hopefully I'll get this working. Thanks
Patrick_Leckey
Participating Frequently
July 30, 2008
That's because ReaderPDF doesn't exist inside your VB application. It exists on the web page, since you added it as an HTML object. You'll need to get to it hierarchically, by accessing your web document as an object and then the ReaderPDF control off of that.
Participating Frequently
July 30, 2008
I don't think I said VB in Windows Forms.
"I dropped the Adobe Acrobat pdf reader browser control on my web form"
This is a web form.
The Adobe Reader control is a component I added in the toolbox.
I am trying to change the 'src' of the reader control within my VB.Net code.

I just showed how the control is defined in the HTML, as an aid in the event the control itself is somehow declared wrong. It also shows how I can assigned the data property the path to a pdf, which does display.

In further research, I found that the pdf displayed can be changed by assigning the path to AdobeReader.src, but again "AdobeReader" or
the id name I gave it "ReaderPDF" show in code that it is not declared. That is the problem. And among the namespace for Acrobat there are many, many different choices.
Sorry for the confusion. Hopefully this makes more sense? Thanks
Patrick_Leckey
Participating Frequently
July 30, 2008
HTML code? You just said you were using VB in Windows Forms. That's very different and needs to be accessed in different ways.

So you're actually using ASP.NET in an HTML page and not VB in a Windows Form, correct?
Participating Frequently
July 30, 2008
"OBJECT id="ReaderPDF" style="Z-INDEX: 102; LEFT: 264px; WIDTH: 504px; POSITION: absolute; TOP: 56px; HEIGHT: 480px"
data="http://ipaddress/BulletinBoard/PDF_Folder/BulletinBoardMessage.pdf"
classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" VIEWASTEXT>
"/OBJECT"

I did not know the forum would not let me post html. Not sure if the above will display with tags removed.
Participating Frequently
July 30, 2008
Thanks for your input. I have not used these types of objects before. I am used to standard web controls where each has a name or at least where one can assign a name. Here is the html code for the adobe reader object:<br /><br /><OBJECT id="ReaderPDF" style="Z-INDEX: 102; LEFT: 264px; WIDTH: 504px; POSITION: absolute; TOP: 56px; HEIGHT: 480px"<br /> data="http://ip address/BulletinBoard/PDF_Folder/BulletinBoardMessage.pdf"<br /> classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" VIEWASTEXT><br /> </OBJECT> <br /><br />With my limited experiense, I thought I could just type in code, <br />me.ReaderPDF.Data = etc... <br />I guess that is not the case. All is not lost though since, I can create a datagrid which contains links to pdf documents on the server and I can open that way. I was just trying to figure out how to use the reader. Thanks
Patrick_Leckey
Participating Frequently
July 30, 2008
> Shouldn't there be some kind of an 'imports' statement at the top of the code for the reader?

Depends which source file you're looking in. There will be one in the source for the form, which is not usually the same file you will do your coding in.

The variable name will be declared in your Form.Designer.vb file, you can also see it by clicking on the object in Design mode, it will be in the header of the property list.

If you don't know how object name assigning works, you should probably take a refresher in VB before trying to develop in it. Pretty much a bedrock principle of the language.
Participating Frequently
July 30, 2008
Yes VB.net, vs 2003.

What would the variable name be? If I try AcroPDF1 I get a compiler message stating that the name 'is not declared.'

If I just drop the control on the form, a generic name should be given. Like a datagrid, is Datagrid1.

???
Shouldn't there be some kind of an 'imports' statement at the top of the code for the reader?
Patrick_Leckey
Participating Frequently
July 30, 2008
> I am not referencing a varible name.

If the Reader control is on your Form, it has a variable name since it is a variable. What language are you using for your form, VB.NET?