Jump to content

Recommended Posts

Posted (edited)

This UDF is because I'm tired of trying to use UI Automation and Send to automate Adobe Acrobat. I often need to read the contents of PDFs and Acrobat is not easy to work with as a window.  The functions are based on the API Reference from Adobe located here.

Acrobat Pro is required for all functions.

It's very beta right now, but it still seems to work. Currently, the functions are based around page level manipulation of PDF documents: re-arranging, swapping, deleting, and moving pages as this is what I use the most.

Please feel free to request/suggest features! :)

 

 

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

You mean that you can't create a AcroExch.PDDoc without Pro? (_Acro_DocOpen would return error 1) I can't test this at work as I have Pro installed everywhere 😐

I guess I assumed that Reader would use the reference too. I might be able to work on this at home where I don't own Pro, but I'm not nearly as familiar with Reader


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites
Posted (edited)

TIL: Adobe Acrobat Pro is required for creating objects through AcroExch.App and AcroExch.PDDoc :(

There may be a way to automate Reader through DDE messages, but I'm unclear on what that is and if it's possible. Looking into it.

Edit: Read way too much on Reader...

Adobe Reader implements a different interface, resulting in a different set of functionality (Read: greatly reduced). I'm running out of ideas with Reader, but I'm pretty sure it implements IAcroAxDocShim (and a few more? C has multiple inheritance?) and can be created with AcroPDF.PDF or AcroPDF.PDF.1 - I think both, but it's something to do with the version of the type library you have.

I also found that not all of the methods are documented. There are three that I found: execCommand, postMessage, and messageHandler (get/set). I have no idea what they are/do. You'll see the methods if you find "Adobe PDF Reader" in the OLE/COM Object Viewer under "Object Classes\Grouped By Component Category\Automation Objects\" and right click to "View Type Information". From there, select 'Dispinterface IAcroAXDocShim' to see the methods available.

Aaand that's enough for now. I'll be dreaming in code tonight for sure.

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Updated to version 0.0.0.2. I found that the JavaScript Object can be accessed and used, meaning that bookmarks are edit-able and so much more.

Added Functions:

  • _Acro_DocDisplay
  • _Acro_PageRotate
  • _Acro_AppShow
  • _Acro_DocJSObject
  • _Acro_DocBookmarkAdd

Fixed:

  • _Acro_PageCount - Actually returns page count now

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Bug: _Acro_PageGetText uses the wrong values to get the size of a page... dyslexia at work again...

Local $oRect = __Acro_Rect(0, $aPoint[0], 0, $aPoint[1])
;            Should be
Local $oRect = __Acro_Rect(0, $aPoint[1], 0, $aPoint[0])

Yeah... that's a good one. I'll try to update this soon. End of the month in accounting with a slow network. Nuff said? :D


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Updated to version 1.0.0.0

Added _Acro_DocAppend, which is my most used function now. I'm constantly combining PDFs at work using this. :)

If you have any suggestions or notice any issues, don't hesitate to let me know!


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...