14 Replies Latest reply on Dec 3, 2008 5:36 AM by (Anders_Hägglund)

    Adobe Reader API

      Regarding Adobe Reader API, I know it's very limited, but all I need to do is open a file and go to a particular page. I've tried:

      With AcroPDF1
      .LoadFile "C:\test.pdf"
      .setCurrentPage 3
      End With

      which gives me "Runtime Error 424, Object Required," and I've tried:

      Dim AcroPDDoc As Object
      Set AcroPDDoc = CreateObject("AcroExch.PDDoc")
      Set pdDoc = CreateObject("AcroExch.PDDoc")

      which gives me "Runtime error 429, Activex component can't create object."

      I've made sure all References to anything Adobe or Acrobat are checked off (I'm programming in MS Access using VB).

      What am I missing?

      Thanks.

      (PS I do own Acrobat Standard that I use on my office machine and I can't get the code to work there either. But I need to be able to use Reader for the project I'm working on.)
        • 1. Re: Adobe Reader API
          Bernd Alheit Adobe Community Professional & MVP
          You can find the information in the Acrobat Interapplication Communication Reference:
          http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/iac/IACReference.pdf
          • 2. Re: Adobe Reader API
            Level 1
            Bernd--

            I've poured over it, but bottom line is I keep getting "Runtime error 429, ActiveX component can't create object" when I try to create any object.

            I'm using Adobe Reader.

            I believe most of the IAC Reference you suggest applies only to acrobat, not to Adobe Reader.

            The only OLE Auto method that I think should work with Adobe Reader is crobat AxAcroPDFLib.AxAcroPDF but I CANNOT find the syntax as to how to create an object with it.

            How do I create an object to open Adobe Reader (not Acrobat)? What's the syntax?
            • 3. Re: Adobe Reader API
              (Aandi_Inston) Level 1
              >How do I create an object to open Adobe Reader (not Acrobat)?

              Example 2.3 in "Developing Applications using Interapplication
              Communication" in the Acrobat 8.1 SDK seems to cover this.

              Aandi Inston
              • 4. Re: Adobe Reader API
                Level 1
                Again, thanks for the reply.

                I have read through the "Developing Applications..." in the SDK and several other publications, but it's still not working.

                I even tried upgrading from Adobe Reader 8.1 to 9.

                (The version of Microsoft Visual Basic I'm using is 6.0 with MS Access 2000.)

                When I simply cut and paste from Example 2.3, the following commands are not recognized:
                Friend WithEvents AxAcroPDF1 As AxAcroPDFLib.AxAcroPDF
                Me.AxAcroPDF1.Location = New System.Drawing.Point(24, 40)
                Me.AxAcroPDF1.Size = New System.Drawing.Size(584, 600)

                MORE OVER, when I simply cut and paste all of Example 2.1, which should be fine, I AGAIN get ...Runtime Error 429, ActiveX component can't create object" at the very first line:
                Set app = CreateObject("AcroExch.App")

                That should tell us there's something wrong that has less to do with syntax and more to do with something basic.

                What could that be?
                • 5. Re: Adobe Reader API
                  Bernd Alheit Adobe Community Professional & MVP
                  You are using a old version of Visual Basic.

                  Example 2.1 requires an installation of Adobe Acrobat.
                  • 6. Re: Adobe Reader API
                    Level 1
                    You mean I'm not using .NET yet?

                    That's true. Do I have to use .NET to programatically open a PDF and skip to different pages? No way in VB6? That would seem strange...
                    • 7. Re: Adobe Reader API
                      Bernd Alheit Adobe Community Professional & MVP
                      > You mean I'm not using .NET yet?

                      You don't need .NET.
                      • 8. Re: Adobe Reader API
                        Level 1
                        Bernd:
                        "You are using a old version of Visual Basic." (6.0)
                        "You don't need .NET."

                        Brother, what do I need?

                        And is it clear that I'm trying to open up an instance of Adobe Reader outside of my database (not inside a form within the database)?
                        • 9. Re: Adobe Reader API
                          (Aandi_Inston) Level 1
                          >And is it clear that I'm trying to open up an instance of Adobe Reader outside of my database (not inside a form within the database)?

                          Not at all clear, and if you want to do that, why are you using
                          AxAcroPDF - this is a browser control, designed to display within a
                          form. It does not open a separate Reader window.


                          Aandi Inston
                          • 10. Re: Adobe Reader API
                            Level 1
                            Thank you! At least I can rule AxAcroPDF out!

                            How would I open an instance of Adobe Reader outside my database? (and then go to different pages)?
                            • 11. Re: Adobe Reader API
                              (Aandi_Inston) Level 1
                              >How would I open an instance of Adobe Reader outside my database?

                              You can start Reader via the Windows API (not OLE).

                              > (and then go to different pages)?

                              There is a DDE interface, not sure if it offers this facility. You
                              might have reached beyond the limits of what is available in the free
                              Reader.


                              Aandi Inston
                              • 12. Re: Adobe Reader API
                                Hi Robert,

                                Maybee this message will be obsolete, but ...
                                I'm actually trying to manipulate PDF files into my program using the API commands.
                                I embedeed into my project the ActiveX (acropdf.dll). I open my document and set it to a specific page using the various command of the API.
                                Actually, I tried to find the documentation for all the functions of the API but didn't succeed into my quest. If you have any informations, It will be very appreciated.

                                If you are still looking for info, come back to me.

                                Laurent Richelle
                                • 13. Re: Adobe Reader API
                                  Level 1
                                  I wanted to open it up in a different program, not my application, so I gave up with Reader and API, and chose to use IE instead. Much more documentation and easier to work with.
                                  • 14. Re: Adobe Reader API
                                    Now this was an interesting thread...

                                    I have a similar problem, but I am not so familiar with VB or javascript or the Windows API, so I would appreciate explicit examples.

                                    I would like to make a .bat script (yes, DOS, under Win XP) to open a .pdf document using Acrobat Reader (v. 8.1.0 in my case). If the document is already open, I would like to close it and reopen it.

                                    Today, I do this with
                                    "C:\Program Files\Adobe\Reader 8.1\Reader\AcroRd32.exe" test.pdf
                                    which works. However, it also locks the file for editing. I therefore need a way (from the command line) to either close test.pdf or open it read-only.

                                    I realize that this (at least closing the document) should be accessible via Adobe Reader API or Acrobat IAC, possibly through the javascript command app.openDoc() (I have looked into the documents mentioned above), but I have no clue about how to do this from the command line. Anyone care to help me out with an example?

                                    Anders Hägglund