Skip to main content
Participating Frequently
Sep 14, 2021 5:42 AM UTC
Answered

Creating AVGrafSelect via python and com

I'm trying to select a rectangular area of a page via python, but I can't manage to do it. From what I've read, a rectangular selection is an AVGrafSelect object, but the command

selection = Dispatch("AcroExch.AVGrafSelect")

 is resulting in the error message 'Invalid class string'. What am I doing wrong? How do I make an AVGrafSelect object?

This topic is closed to new replies. Start a new post to keep the conversation going.
Bernd Alheit
Bernd AlheitCorrect answer
Community Expert
Sep 14, 2021 10:50 AM UTC

May be that the use of this is only possible in a plugin.

5 replies

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
Sep 14, 2021 10:50 AM UTC

May be that the use of this is only possible in a plugin.

Translate
Legend
Sep 14, 2021 2:59 PM UTC

You are right Bernd, I missed that. You cannot mix and match the different APIs. The plug-in API is only accessible to plug-ins (not external apps) and plug-ins can only be written in C++.

Translate
Participating Frequently
Sep 14, 2021 11:35 PM UTC

Thanks for explaining. If I can't create an AVGrafSelect object from an external program, is there another way I can select a rectangular area?

(what I actually want to do is copy a rectangular area, but I want to copy it in the form that selecting and copying it gives, not as an image like CopyToClipboard does, so I was wanting to select a rectangular area and use MenuItemExecute to copy it.)

Translate
Legend
Sep 14, 2021 8:09 AM UTC

What specific product is installed? Acrobat Pro, Acrobat Standard, Acrobat Reader, Adobe Reader, other?

What specific version is installed?

And: Please give documentation link for AVGrafSelect. I do not see it in the Acrobat developer info. Indeed, what would "select a rectangular area" even mean? Perhaps the bigger picture will be helpful.

Translate
Participating Frequently
Sep 14, 2021 11:09 PM UTC

By "select a rectangular area" I mean like this:

The cursor for doing it is a standard arrow-shaped cursor with a rectangle to the bottom right.

Translate