Re: Illustrator 9 & Group Items
Re: Illustrator 9 & Group Items
- Subject: Re: Illustrator 9 & Group Items
- From: Shane Stanley <email@hidden>
- Date: Mon, 16 Jul 2001 10:44:45 +1000
On 16/7/01 9:14 AM +1000, Jason Bourque, email@hidden, wrote:
>
On 7/15/01 6:46 PM, "Shane Stanley" <email@hidden> wrote:
>
>
> On 16/7/01 1:16 AM +1000, Jason Bourque, email@hidden, wrote:
>
>
>
>> I am trying to get the width & height of every page item as a group in
>
>> illustrator 9 and the resize the document to that found width & height.
>
>>
>
> I'm not sure why you'd try this; you can't change the size of the document,
>
> and it's pretty much irrelevant anyway.
>
>
>
Well clients can come up with the strangest requests. Hmmm, let me explain.
>
>
My client wants a PDF version of the multiple types of charts my scripts
>
create for them(all different sizes), but they want it cropped to the size
>
of the chart plus a little buffer room. So when you save it as a pdf the
>
page size sticks with it unlike saving to a gif, where its cropped to the
>
size of the artwork.
My first inclination would be to save as eps and then Distill, but that's
not always going to be feasible, and it's probably going to be slower.
>
>
Your right about the page size, I will create a new document with the chart
>
dimensions and copy between docs. Work arounds are a pain.
No, the real pain is when there _aren't_ any workarounds...
>
>
>
I just found a work around take a look and
>
tell me what you think. And maybe you can explain to me what happens with
>
the page origin of the newly created doc. It's not {0,0}
I think the odd origin is to do with the relationship between the pasteboard
size and artboard size, but I'm not sure. IAC, it's easily changed.
>
>
tell application "Adobe Illustrator. 9.0.2" activate
>
set selected of every page item of document 1 to true
>
set selectedItems to selection of document 1
>
make new layer at end of document 1
>
set layerIndex to index of result
>
set groupRef to make new group item at beginning of layer layerIndex
>
of document 1 with properties {name:"Group Crop"}
>
set groupedPageItems to duplicate selectedItems to beginning of groupRef
>
set groupWidth to width of groupRef
>
set groupheight to height of groupRef
>
-->>Make New Document<<
>
make new document with properties {color
>
space:CMYK, width:groupWidth + 4, height:groupheight + 4}
>
set pageItemRef to duplicate group item "Group Crop" of layer layerIndex of
>
document 2 to beginning of document 1 with properties {position:{169 + 2,
>
566 - 2}}
Making a new layer and group is probably unnecessary. Try something like
this:
tell application "Adobe Illustrator. 9.0.2"
tell document 1
set {a, b, c, d} to geometric bounds
if a = 0 or d = 0 then -- work around bug
translate every page item of every layer delta x -c delta y -b
set {a, b, c, d} to geometric bounds
end if
end tell
make new document with properties {color space:CMYK, width:c - a + 4,
height:b - d + 4, ruler origin:{0, 0}}
duplicate page items of layers of document 2 to beginning of document 1
tell document 1
set {a, b, c, d} to geometric bounds
translate every page item of every layer delta x 2 - a delta y 2 - d
end tell
end tell
--
Shane Stanley, email@hidden