Jump to content

Acobat 9.0


fujibot
 Share

Recommended Posts

Hello everyone. This is my first post here and I'm a bit of a AutoIt newbie.

I'm having trouble using the SetTextSelection method with Acrobat's API.

Here is some code that is simple and works up until the last statement. Any clues? My goal is to declare a rectangle and grab the text inside it. Any help?

$filetest = "c:\scotta\2pages.pdf"

$App = ObjCreate("AcroExch.App")

$App.Show

;so far so good

$AVDoc = ObjCreate("AcroExch.AVDoc")

$AVDoc.Open($filetest, "")

;interestingly, this only opens the file every other time, but acrobat always starts. hmmm....

$PDDoc = ObjCreate("AcroExch.PDDoc")

$PDTextSelect = ObjCreate("AcroExch.PDTextSelect")

; Not sure if I even need this

$acroRect = ObjCreate("AcroExch.Rect")

$acroRect.Bottom = 200

$acroRect.Left = 400

$acroRect.Right = 400

$acroRect.Top = 400

$PDDoc.CreateTextSelect(0,$acroRect)

;doesn't crash here so keep going....

$AVDoc.SetTextSelection(What goes in here? Anyone?)

;BOOM! crash.....:-(

~ Thanks for any input/help at all.

Link to comment
Share on other sites

  • 2 years later...

Given the date of hte post, this might be useless to the original psoter, but for anyone else searching the forums and wondering about the answer...

The crash above was caused because the poster didn't pass the text selection object to the SetTextSelection...

$selection = $PDDoc.CreateTextSelect(0,$acroRect)

$return = $oAcrobat.SetTextSelection($select)

$return = $oAcrobat.ShowTextSelect()

$return = $oApp.MenuItemExecute("Copy")

And you'd have the contents of the selection rectangle in the clipboard..."text = Clipget()

Hope this helps somebody at some point.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...