Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open PDF with OLE

1,920 views
Skip to first unread message

Michael Hagl

unread,
Jan 19, 2012, 12:49:16 PM1/19/12
to
Hi,

does anybody kow how to use AcroPdf

The following code shows no error but does not open the pdf

LOCAL oPdf
LOCAL oAvDoc
oPdf := CreateObject("AcroPdf.pdf")
oPdf:LoadFile("x:\pdf\netset.pdf")
oPdf:PrintAll()



Thank you

Michael Hagl


Eugene F.

unread,
Jan 20, 2012, 3:52:37 PM1/20/12
to
Michael,

Is "AcroPdf.pdf" the exact name of the application/class as it
installed on your computer?

Your sample code does not seem to include any error checking.

xHB docs suggest the following, using Word in their example:

TRY
oWord := CreateObject( "Word.Application" )
CATCH
Alert( "ERROR! Word not avialable. [" + Ole2TxtError()+
"]" )
RETURN
END

I also suggest that you check for the existence of the file you open
before calling LoadFile method.

HTH, Eugene

====================================================

Klas Engwall

unread,
Jan 20, 2012, 6:03:30 PM1/20/12
to
Hi Michael,

> does anybody kow how to use AcroPdf
>
> The following code shows no error but does not open the pdf
>
> LOCAL oPdf
> LOCAL oAvDoc
> oPdf := CreateObject("AcroPdf.pdf")
> oPdf:LoadFile("x:\pdf\netset.pdf")
> oPdf:PrintAll()

Where did you find the info you used here? Can you provide a link to a
web page?

In general, I would recommend that you inspect acrobat.exe (or
acroread.exe ?) using a type library viewer like the one found here:

http://www.itripoli.com/itlv.asp

and then google for the member names you see in the viewer to get more
info about them (if you are lucky :-) ). Info about the Acrobat object
model on the web is very sparse, there are many questions and few answers.

Additionally, what Eugene said is very important: Verify every step your
code takes so you know where the error occurs.

Regards,
Klas

Michael Hagl

unread,
Jan 23, 2012, 9:44:07 AM1/23/12
to
Eugene,

I know this. This was my first test.

The AcroPDF - laoding is ok, no error but when looking with debugger I can
see OLEVALUE: DISP_E_MEMBERNOTFOUND

I have not find any solution yet.


TRY
oPdf := CreateObject("AcroPdf.pdf") // seems to be loaded
CATCH
Getwait("acro nicht geladen")
END

TRY
oPdf:LoadFile("C:\NETSET.pdf") // no error but returns .f.
CATCH
Getwait("datei nicht geladen")
END

Getwait(oPdf:GetVersions()) // shows version info


Michael



"Eugene F." <pm77...@gmail.com> schrieb im Newsbeitrag
news:09d8b5a7-1e19-4713...@b20g2000yqb.googlegroups.com...

Michael Hagl

unread,
Jan 23, 2012, 10:05:14 AM1/23/12
to
Hi Klas,

I found the info somewhere in internet
(http://www.directorforum.de/threads/5162-PDF-activex-methods)
but I dont find any documentation.

see my message to eugene.

I only want to print pdf files (but not to default ptinter)
ShellExecute() only prints to default printer
When first setting default printer, I have to wait until the pdf is printed
and than I can reset the defautl printer

Using commandline (run), than my prog stand still untill I close the open
acroreader.


Michael




"Klas Engwall" <klas.e...@nospam.please> schrieb im Newsbeitrag
news:jfcrs5$1c6q$1...@news.ett.com.ua...

Klas Engwall

unread,
Jan 23, 2012, 9:36:51 PM1/23/12
to
Hi Michael,

> I found the info somewhere in internet
> (http://www.directorforum.de/threads/5162-PDF-activex-methods)
> but I dont find any documentation.

The discussion on the forum you linked to unfortunately ends up on a
track that leads to the PDF Reference manual, which describes the PDF
file format in every tiny detail. But you need info about the interface
of the Adobe Acrobat or Adobe Reader applications. For that purpose a
type library viewer like the one I mentioned the other day is quite
useful as it opens the application file on your harddisk and extracts
the info from it.

But I think that I have also found the documentation you were looking for:

http://www.adobe.com/devnet/acrobat/interapplication_communication.html

That page has links to various interapplication communication reference
manuals for Acrobat 8, 9 and X.

Good luck :-)

Regards,
Klas

danca

unread,
Jan 24, 2012, 11:45:28 AM1/24/12
to
IIRC Acrobat Reader cannot be used as OLE server, only the full version.
Maybe I'm not correct, but I remember to have been in the same situation
some years ago. Maybe Foxit Reader?...
HTH
D. Campagna

Klas Engwall

unread,
Jan 24, 2012, 2:20:31 PM1/24/12
to
Hi danca,

> IIRC Acrobat Reader cannot be used as OLE server, only the full version.
> Maybe I'm not correct, but I remember to have been in the same situation
> some years ago. Maybe Foxit Reader?...

Well, it can, but the capabilities are limited: "Adobe Reader does not
support OLE automation, except for the PDF browser controls provided in
the AcroPDF object", according to the web page at:

http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat9_HTMLHelp&file=IAC_DevApp_Architecture.99.1.html

About the AcroPDF object: "This object provides you with the ability to
load a file, move to various pages within a file, and specify various
display and print options" (from another page in the same tree)

With the full version of Acrobat the internals of the document can also
be accessed. Follow the link I posted yesterday for further info.

Regards,
Klas
0 new messages