These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

PDF viewer in VB6 ? (bit long)

crow_se
Registered: Feb 18 2008
Posts: 8
Answered

Hello all
Apologies if this is the wrong forum for this query, but I am not sure what category it comes under.
I am retired, and for my own amusement I am writing a program in VB6 on XP SP2, for part of which I would like to display pdf files.
My wife is heavily into crafting, making greetings cards for birthdays, Xmas etc. She has bought a few cds with various graphics that she uses for these cards.
To save having to keep swapping the cds to look for what she wants to use, which can take quite a time if she doesnt know what she wants, I have copied them to my hard disk and written a program in VB6 which allows opening any of these copied cds by either running the exe in the appropriate folder or opening in ACDSee 6 or Ashampoo Photo Commander 5 for browsing, editing etc.
She also has things that she uses in pdf files, as well as assorted knitting and sewing patterns. I thought that it would be nice to bring these together in my program to allow browsing in the same manner as an image browser, but using a pdf thumbnail viewer (?) of some sort within the program so that we could browse through the pdfs when she wants something that is in one file but we dont know which, and could switch from graphic to pdf browsing easily and quickly. A browser such as I have said would at the very least give us an idea of which file to look at without opening them one after another in Reader.
I found a reference that said to use the pdf.ocx that came with Acrobat Reader 5. I added this to the project and placing on a form, then loaded a file with
pdf1.loadfile "........."
When this statement was reached I received a dialog stating
Could not find Acrobat External Window Handler

The viewer will only be used for this program on my personal pc and the program will be infrequently used, only when birthdays etc are on the horizon, so I dont want anything that has to be paid for. I dont want to edit or create pdf files, only view them then open in an external program.
I could open them with Reader but again this would not allow browsing in the same manner as an image browser.
I have come across references to an AcroPDF.ocx in your forums, which is said to be variously part of Acrobat Reader 7 or 8, together with the pdf.ocx from Reader 5. I have installed Reader 5, 7 and 8, but there is no acropdf.ocx, only an acropdf.dll, which also gives me errors on Loadfile. In fact it crashes the VB IDE. I cannot find this AcroPDF.ocx except in the references above.
I would be grateful for any advice.
Stuart

lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
PDF.OCX is an old and unsupported component. Acrobat/Reader 7 and later contain the AcroPDF.dll, for ActiveX control.

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

crow_se
Registered: Feb 18 2008
Posts: 8
Thanks for the reply.
I have tried this AcroPDF.dll, opening VB6 to create a new windows exe, then Project - References then browse to the dll location. This then displays Adobe Acrobat 7.0 Browser Control Library 1.0 in the Available References listbox. If I then check the checkbox for this item and press OK I receive a dialog saying Error in loading dll.
If I use Project - Components and check Adobe Acrobat 7.0 Browser Control Library 1.0 followed by Apply or OK I get a dialog stating
C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll could not be loaded. The version of this dll is 8.1.0.0.
Stuart
lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
There is a sample in the following developer document on how to open a pdf from IAC (Interapplication Communication) for Visual Basic at: http://www.adobe.com/devnet/acrobat/pdfs/samples_guide.pdf
It includes the code to launch the Acrobat viewer, open a PDF file (C:\sample.pdf), and get simple information (number of pages).

Hopefully this will help you.

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

crow_se
Registered: Feb 18 2008
Posts: 8
Thanks for the reply, but as I said this is not what I want. To just open a file I could do that with Reader, but what if I dont know what file I want to open ? As it stands now I would have to go through every pdf file and open it in Reader until I find the one that I want.
What I am trying to do is have some sort of thumbnail type viewer within my program so that I could get some idea of the file to open.
As I said, this would be used once for my program which would probably be run 2 or 3 times a year, so it is not a viable option to buy anything.
Stuart
lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
The pdfshell.dll file controls the thumbnail view in Windows -- it was introduced in Acrobat 7.

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

crow_se
Registered: Feb 18 2008
Posts: 8
Thanks for reply.
Sorry to keep pestering but is there any information on how to use pdfshell.dll ? I added the reference to my project and created an instance as follows :
Dim p As PDFShell
Set p = New PDFShell
When I try to access the pdfshell properties in the normal manner, ie. p.
then there is no list of properties.
Stuart
lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
Not that I'm aware of. You can try asking this on the U2U Developer forum at:
http://www.adobeforums.com/webx/.eed56a0/

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

crow_se
Registered: Feb 18 2008
Posts: 8
Thanks for the help and advice
Stuart