Skip to main content
Participant
January 16, 2008
Question

Changing document size on opening AI file

  • January 16, 2008
  • 5 replies
  • 1158 views
Hi,

I need to set the document size dynamically when opening AI files. AIDocumentSuite::SetDocumentSetup should do it. But the problem is SetDocumentSetup can be called only before the document is opened.

The call has failed in both kAIDocumentOpenedNotifier and kAIFileFormatDocumentOpenedNotifier that are sent to my plugin after the document is fully opened. I cannot find any notifier in which the call would succeed.

Any help is greatly appreciated!

John
This topic has been closed for replies.

5 replies

Participant
December 4, 2008
I'm trying to do the same thing: adjust a document's height and width from the API.

AIDocumentSuite::SetDocumentSetup() evidently does not accomplish this. An action (as suggested above by A. Patterson) will not record past the Menu Item, so the new values entered into the Document Setup dialog are not registered as part of the action. Hence I have no height/width parameters in the text to play with using PlayAction().

All I really need to be able to do is swap the orientation of an existing document to landscape from portrait (or vice-versa) from a script or preferably from the API. Something like:

AIDocumentSetup setup;
sAIDocument->GetDocumentSetup(&setup); /* from current document */

AIReal tempWidth = setup.width;
setup.width = setup.height;
setup.height = tempWidth;

sAIDocument->SetDocumentSetup(&setup); /* changes applied back to current document */

Does anyone have some helpful insight that will help me get this working?

Thanks!
Jeff
A. Patterson
Inspiring
June 16, 2008
If you want to use the Action Manager, create your own action set & record a macro of changing the document size. The save the action set (.aia) on to your desktop or somewhere you can find easily. Open the .aia in a text editor and it should present the action name & the parameter names it's expecting. That should let you feed those into the AIActionManager::PlayAction() method -- and use whatever numbers you want for the page size.

Hope that helps!
Participant
June 12, 2008
in vb script is it done as---- as its a read only property cant be changed later

Dim appRef
Dim garmentDoc
Set garmentDoc = appRef.Documents
garmentDoc.Add 2,2160,3600
Participant
January 21, 2008
Thanks for replying.

Do you mean I can use Action Manager to change the document size programatically without user's input? Please give more detail.

Regards,

John
3DTOPO
Inspiring
January 16, 2008
You should be able to accomplish this with the scripting capabilities.

Regards,

-jeshua