Adobe Illustrator save as PDF

I'm not exactly sure where my new problem lies. I'm trying to save out single page PDFs from an Illustrator CS4 document with multiple artboards. Each artboard should become a PDF. I can get a multi page PDF, but when it saves single page files, I get white PDFs with error messages on them (I think it is saving .ai files with a .pdf extension).

this is where I am now (simplified, of course):

---------------------------------

tell application "Adobe Illustrator"
set docName to name of current document

set itemNumber to 1
tell application "Finder" to set fileLoc to path to desktop as string

set pageCount to (count artboards in document docName)

tell current document
set allPlacedItems to placed items
repeat with h from 1 to (count of allPlacedItems)
set thisPlacedItem to item h of allPlacedItems
tell thisPlacedItem to embed
end repeat

set allTextItems to text frames
repeat with j from 1 to (count of allTextItems)
set thisTextItem to item j of allTextItems
tell thisTextItem to convert to paths
end repeat
end tell

repeat with i from 1 to pageCount

set pdfSaveOptions to {class:PDF save options, pdfXstandard:PDFX None, compatibility:Acrobat 6, preserve editability:false, generate thumbnails:false, optimization:false, acrobat layers:false, artboard range:i, view pdf:false, color downsampling:0, color resample:nodownsample, color compression:none, grayscale downsampling:0, grayscale resample:nodownsample, grayscale compression:none, monochrome downsampling:0, monochrome resample:nodownsample, monochrome compression:none, compress art:false, trim marks:false, registration marks:false, color bars:false, page info:false, page marks style:Roman, trim mark weight:trimmarkweight025, offset:6.0, bleed link:true, bleed offset:{0, 0, 0, 0}, color conversion id:none, color destination id:none, color profile id:include all profiles, trapped:false, font subset threshold:50.0}

set pdfName to docName & " TEST" & itemNumber & ".pdf"
set destFile to (fileLoc & pdfName) as string

save document 1 in file destFile as pdf with options pdfSaveOptions

set itemNumber to (itemNumber + 1)
end repeat
close current document without saving
end tell

2.4Ghz 20" iMac, Mac OS X (10.5.2), 1.3Ghz 17" PowerBook & iPhone!

Posted on May 6, 2009 7:23 PM

Reply
5 replies

May 11, 2009 7:47 AM in response to stephen_42

Hi Stephen,

The problem is that the input for the page range is text (even if it is just one number). You're trying to put in a Number (the i you get from the loop). You'll need to convert the number to a string, probably by using the "as text" command.

What I use is (simplified): first check for multiple art boards (and set the range as text), if there is only one set the multiple artboards option to false, else set the page range. You don't have to build a loop to export each artboard seperately.

tell document 1
if (count of artboards) > 1 then
set pagina_bereik to "1-" & ((count of artboards) as text)
else
set pagina_bereik to "1"
end if
end tell

if pagina_bereik = "1" then
save document 1 in file DestFIle as eps with options {class:EPS save options, preview:color TIFF, embed all fonts:true, embed linked files:true, include document thumbnails:true, PostScript:level 2, save multiple artboards:false}
else
save document 1 in file DestFIle as eps with options {class:EPS save options, preview:color TIFF, embed all fonts:true, embed linked files:true, include document thumbnails:true, PostScript:level 2, save multiple artboards:true, artboard range:pagina_bereik}
end if

Hope this helps,
Ton

May 11, 2009 8:22 PM in response to Ton Markus

hello Ton,

I just noticed that I had a reply!
I tried adding "save multiple artboards:true" to my settings, but then noticed that you were saving EPS files.

I did change my page range to a string, but it did not help. I get what appears to be a pdf (single page) of each artboard, which is looking correct, but every pdf contains a long message that this Adobe Illustrator file was saved without PDF compatibility... I find it pretty odd that a PDF could be saved without PDF compatibility.

So it still does not work. Any other ideas?

May 13, 2009 1:32 AM in response to stephen_42

Hi Stephen,

My Bad.. We've got two script running alongside which ar 95% the same. One for exporting eps's and one for pdf's. I was working on the eps one when I stumbled across your question, so I got some code from that one.

But you are absolutely right, the artboard range in pdf generates that strange error message. It will still open in Illustrator but it's not a pdf.. And it still contains all pages, so there must indeed be some error in the function.

The next step I can think of is generating a pdf with all pages in it in Illustrator and then opening this pdf with Acrobat Pro, which has under the "Document" menu-item a "Split PDF" option (I've got a dutch version of Acrobat so the actual english menu item may be called differently). It's a bit cumbersome, but all I can think of now. And I'm not sure you can script this option but you can at least open the file in Acrobat so it's just one manual action.

Regards,

Ton

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Adobe Illustrator save as PDF

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.