By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

Display a PDF from Visual Basic 6.0

P: 3
Was wondering if anyone can help with a rather simple task. I am trying to display a PDF file when the user clicks a command button from a simple VB 6.0 form. I have AcroRd32.dll version 7, but all the documentation I find is for version 4.0, which does not work. Was wondering if anyone knows how to use this version that comes with Acrobat 7.0, or if there is an easier way. I already spent 2 days "googling" this. I also tried FreeVBCode.com. The code they provided would not compile, so obviously I'm using the wrong DLL for their code. Very desperate to get this done, so thanks for any help.
Apr 26 '07 #1
Share this Question
Share on Google+
4 Replies


SammyB
Expert 100+
P: 807
Was wondering if anyone can help with a rather simple task. I am trying to display a PDF file when the user clicks a command button from a simple VB 6.0 form. I have AcroRd32.dll version 7, but all the documentation I find is for version 4.0, which does not work. Was wondering if anyone knows how to use this version that comes with Acrobat 7.0, or if there is an easier way. I already spent 2 days "googling" this. I also tried FreeVBCode.com. The code they provided would not compile, so obviously I'm using the wrong DLL for their code. Very desperate to get this done, so thanks for any help.
Assuming that you have Adobe Reader, then you have pdf.ocx which is what you want to use. In VB6, right-click on the toolbox and select components. Browse to pdf.ocx (it was in Program Files\Adobe\Acrobat\Reader\ActiveX on my machine). That adds Acrobat Control for ActiveX, click OK. Add the control to your form and you're good to go. Use the LoadFile method to ,duh, load a file. It has problems: is not a full ActiveX control, but hopefully it will do what you want. --Sam
Apr 26 '07 #2

P: 3
Sam,

Thank you so much! :) I knew it had to be easy, just couldn't find the right tool. I was trying to use a .DLL, because of the available documentation. My ocx is called AcroPDF.ocx and is in a different location than yours, but it works!!! Thanks again for this simple solution!
Apr 27 '07 #3

P: 3
Assuming that you have Adobe Reader, then you have pdf.ocx which is what you want to use. In VB6, right-click on the toolbox and select components. Browse to pdf.ocx (it was in Program Files\Adobe\Acrobat\Reader\ActiveX on my machine). That adds Acrobat Control for ActiveX, click OK. Add the control to your form and you're good to go. Use the LoadFile method to ,duh, load a file. It has problems: is not a full ActiveX control, but hopefully it will do what you want. --Sam

The AcroPDF does have problems. Once you end the VB application, the PDF closes but AcroRD32.exe is still running and occupying memory. After about 4 or 5 executions, you run out of memory. I have to run the task manager to end the AcroRd32.exe process. I read in other forums about this problem, but no solutions were posted. Can't have users running their task manager. The process should end when the VB app is closed. Can anyone help?
Apr 28 '07 #4

P: 1
Is it possible to specify the password with code in case of a password protected file ? Ofcourse given the fact we know the password .
Jun 3 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.