Adobe Acrobat - ActiveX - VBScript 
Author Message
 Adobe Acrobat - ActiveX - VBScript

Pardon me in advance please for the length of this, I'm
trying to present enough information for someone to be
able to answer my question.

I'm trying to control Acrobat (_not_ the Reader, but
the full product) via Client-side VBScript.
Yes, this is an intranet environment, so security isn't a problem.

The problem is that the page below loads,
and everything works up until the line marked with '***':

I get the error message "Error: Object Required 'PDDocObject.GetNumPages'"

I added some debugging code to print the VarType of PDDocObject,
and it returns a '9', same as the AVDocObject, AVPageObj and AcroObject.

The Acrobat SDK definitely defines GetNumPages a:s a method for an
object of type PDDoc. (Method GetPDDoc returns an object of type PDDoc)

Since my method call GetAVPageView properly returns an AVPage object,
I can only assume that the GetPDDoc method is working as well.

AcroExch.App has a CLSID = {85DE1C45-2C66-101B-B02E-04021C009402}
AcroExch.AVDoc           = {72498821-3203-101B-B02E-04021C009402}
AcroExch.PDDoc           = {FF76CB60-2EC8-101B-B02E-04021C009402}
AcroExch.AVPage does NOT appear in the registry.

App and AVDoc have entries in the registry under H_C_R\CLSID,
but PDDoc does not. Since AVPage doesn't appear by name in the
registry, I don't know if there's a CLSID associated with it.

Any information that anyone can provide would be most appreciated.

<HTML>
<HEAD><TITLE>A Simple First Page</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
option explicit
Dim AcroObject, AVDocObject, PDDocObject, AVPageObj

Sub Button1_OnClick
        dim DocPageCount, msg
        SET AcroObject = CreateObject("AcroExch.App")
        call AcroObject.Show()
        set AVDocObject = CreateObject("AcroExch.AVDoc")
        call AVDocObject.Open("c:\readme.pdf", "ReadMe")
        set AVPageObj = AVDocObject.GetAVPageView
        set PDDocObject = AVDocObject.GetPDDoc
        call AVPageObj.goto(5)
***     set DocPageCount = PDDocObject.GetNumPages

End Sub

-->
</SCRIPT>
</HEAD>
<BODY>
<H3>A Simple First Page</H3><HR>
<FORM NAME="AnnotMgr"><INPUT NAME="Button1" TYPE="BUTTON" VALUE="Launch Acrobat">
<P>
<P>
<TEXTAREA NAME="txtDebug" ROWS="10" COLS="60"> </TEXTAREA>

</FORM>

</BODY>
</HTML>



Sun, 20 Jul 2003 15:12:14 GMT  
 Adobe Acrobat - ActiveX - VBScript
All,

        Well, I found my own answer to my problem. The problem
arose from my misunderstanding the difference between a 'set'
statement and a standard assignment statement.

        The error message wasn't referring to the 'PDDocObject.GetNumPages'
as being in any way invalid. What it was actually telling me is
that with a set statement, what is on the right side of the
assignment operator must be an object. But, GetNumPages returns
a long integer, so that creates the error message.

Ken

Quote:

> Pardon me in advance please for the length of this, I'm
> trying to present enough information for someone to be
> able to answer my question.

> I'm trying to control Acrobat (_not_ the Reader, but
> the full product) via Client-side VBScript.
> Yes, this is an intranet environment, so security isn't a problem.

> The problem is that the page below loads,
> and everything works up until the line marked with '***':

> I get the error message "Error: Object Required 'PDDocObject.GetNumPages'"

> <HTML>
> <HEAD><TITLE>A Simple First Page</TITLE>
> <SCRIPT LANGUAGE="VBScript">
> <!--
> option explicit
> Dim AcroObject, AVDocObject, PDDocObject, AVPageObj

> Sub Button1_OnClick
>         dim DocPageCount, msg
>         SET AcroObject = CreateObject("AcroExch.App")
>         call AcroObject.Show()
>         set AVDocObject = CreateObject("AcroExch.AVDoc")
>         call AVDocObject.Open("c:\readme.pdf", "ReadMe")
>         set AVPageObj = AVDocObject.GetAVPageView
>         set PDDocObject = AVDocObject.GetPDDoc
>         call AVPageObj.goto(5)
> ***     set DocPageCount = PDDocObject.GetNumPages

> End Sub

> -->
> </SCRIPT>
> </HEAD>
> <BODY>
> <H3>A Simple First Page</H3><HR>
> <FORM NAME="AnnotMgr"><INPUT NAME="Button1" TYPE="BUTTON" VALUE="Launch Acrobat">
> <P>
> <P>
> <TEXTAREA NAME="txtDebug" ROWS="10" COLS="60"> </TEXTAREA>

> </FORM>

> </BODY>
> </HTML>



Mon, 21 Jul 2003 08:43:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ActiveX DLL to read Adobe Acrobat PDF file

2. HELP: Adobe Type manager, Adobe Sans MM, Adobe Serif MM, Acrobat Distiller

3. FYI - Newsletter #5: Printing PDF files, how to use Adobe Acrobat Reader ActiveX control PDF.ocx

4. detect Adobe Acrobat Reader (IE plugin) in VBScript?

5. Changing Default Printer to Adobe Acrobat Writer

6. Problems launching Adobe Acrobat and supplying the file name

7. Export data to Adobe Acrobat 4.0

8. Exporting Query data to Adobe Acrobat - how?

9. Automating Adobe Acrobat, (creating pdf's)

10. Adobe Acrobat using Automation

11. Access 97 and Adobe Acrobat

12. Export Adobe Acrobat to Access?

 

 
Powered by phpBB® Forum Software