Copy link to clipboard
Copied
I'm rewriting some export scripts of mine and I've just come across something strange...
Part of my multi-export script saves a PDF for each artboard. The code looks something like this:
for ( var i = starting_artboard; i < num_artboards; i++ ) {
starting_artboard = doc.artboards.setActiveArtboardIndex(i);
var saveOptions = new PDFSaveOptions();
saveOptions.compatibility = PDFCompatibility.ACROBAT6;
saveOptions.generateThumbnails = true;
saveOptions.preserveEditability = true;
saveOptions.artboardRange = i+1;
doc.saveAs( dest, saveOptions );
}
Now, this works perfectly, and I get a PDF for each artboard... until I open one of those PDFs back up in Illustrator and all the artboards are still there. So each PDF has all the artboards (not just the content of the artboards, but the actual artboards, still named and placed as they were). Weirdly the artboards don't exist *anywhere* else. They don't exist if I open the PDFs in Acrobat, Photoshop, any random PDF viewer, anywhere; only in Illustrator.
Any idea why and how I can fix this? I'm hoping I'm missing something obvious and I don't have to copy the artboard to a new temp doc and save that, but I can't find anything in PDFSaveOptions that should be causing this.
It's probably the territory coming along with "preserveEditability" being true, try doing without it if you're able to.
Copy link to clipboard
Copied
It's probably the territory coming along with "preserveEditability" being true, try doing without it if you're able to.
Copy link to clipboard
Copied
Yup, works perfectly. Like I said "...missing something obvious"
Copy link to clipboard
Copied
Hey Cai,
Your script looks interesting! Would you know if it would be possible to use the names of the artboards as the names of the exported files? see screenshot (sorry in dutch, tekengebieden is artboards). Thanks in advance! Stefaan
Copy link to clipboard
Copied
Yea it's possible:
doc.saveAs( destFolder + "/" + doc.artboards.name + ".ai", saveOptions );
I think.
Copy link to clipboard
Copied
didn't work, but this does
thx all the same!
Copy link to clipboard
Copied
Ha it probably did not work, because the destination part should have been wrapped in a File() constructor.
But, here's an idea - the multi artboard export scripts are neat, but have they not been now replaced by the native Artboard Exporter feature?
Copy link to clipboard
Copied
yep, but the main issue was that i wanted to use the same naming as the artboards names… and it does in this script.
Copy link to clipboard
Copied
The new asset exporter uses artboard names, and you can add prefix/suffix as well as scaling.