I’m trying to write a script to output a PDF file.
The basic premise is we prefer to use Distiller to create PDFs since they have proven to be more cross-platform and printer tolerant than ones made directly from native applications like Illustrator and InDesign.
So we prefer to output to PostScript, the put those into Distiller with one of three custom-made profiles. Nice, consistant, compatible PDFs every time. Except that they are a royal PITA to do that way.
About a month ago, my first “big script” for the department was big hit. We felt comfortable enough to offer to do more of this kind of automation work as a regular service, and when we asked for project ideas, automating PDF creation was tops on the list.
So far, thanks to scouring MacScripter, I’ve got Illustrator creating an appropriate PostScript file. However, there is a wrinkle I can’t get past.
Because of the way we work, rarely are our PDFs in sizes like Letter, Tabloid, etc. Almost always “custom” and very rarely is the actual image the size of the page. We prefer our PDFs to be cropped to the outermost bounds of the visible artwork, not the page size.
We can’t use EPS like we used to (EPS exports to Distiller automatically “crop” like this), because of the transparency features of the new Adobe CS applications.
When we print these files, if you select “Custom” in the page size, Illustrator automatically puts in the “cropped bounds” we’re looking for, but I can’t seem to mimick this behavior via scripting of the PostScript export itself. I’ve also tried Prefab’s UI Actions, but Illustrator is being stubborn in this regard.
My other idea was to figure out the outer bounds myself. The easiest way seemed to use Select All and then getting information on this selection (similar to what displays in the Info palette when you Select All). However, any attempt to get dimensions from a “Select All” selection yield the dimensions from a single sub-object in the selection (the one with the lowest ID number near as I can tell).
I had thought to Select All, then use Group, but then I’d make a mess of the artwork in the process (since our artists rely heavily on layers).
This is what would seem logical, and it does correctly “Select All,” that’s as far as I’ve gotten.
set selection to every page item of current document set artwork_width to width of selection as string set artwork_height to height of selection as string
I’m a little annoyed that the solution to this might be purchasing a book everyone keeps referencing, just to do something that should be more clear in their Library entires. I will if I have to, but if anyone else knows how to do this, I’m all ears.