Skip to main content
Participant
July 19, 2007
Question

Tweaking the SaveDocsAsPDF script

  • July 19, 2007
  • 35 replies
  • 14666 views
Hello. Absolute scripting newbie here; will someone take pity...?

I am looking at the SaveDocsAsPDF script. It works for our purposes except I would like it to save PDFs using a Preset we created called "SGS PDFs. (We have trouble with people in our office forgetting to choose this setting, so I thought a script might be the answer.)

I found a posting on this forum where someone wanted to save files as small as possible, and got some clues from that. So I left everything as is in the original script, except I added this first line in the function:
{var NamePreset = '[SGS PDFs]';

Then after the line:
var options = new PDFSaveOptions();

I added:
options.PDFPreset=NamePreset;

I thought this would result in a script that does the same thing I now do "manually". However, if I save my document "manually" using File/Save As/ Adobe PDF, and choosing the SGS PDFs preset (and changing nothing else), I get a 716 KB file. But if I use my script, I get a 4.9 MB file. So it appears that what I added is NOT making the script use my preset settings.

So my question is: Is there something REALLY basic missing from my script, or... In order to get a script that accomplishes everything already determined in the Preset, do I manually have to list all those settings as options?

I think I can do the latter if I need to if I just study some of the other scripts... unless there's a shortcut!
This topic has been closed for replies.

35 replies

Participant
June 19, 2008
This is so strange and frustrating ... it does not save in any folder regardless of permissions. The original SaveDocstoPDF script fails as well.

I booted from a different drive (which has a fresh WinXP installation). Installed Illustrator from scratch and the script still fails.

The file can be saved the regular way, but the script fails ... what the heck !
Larry G. Schneider
Community Expert
Community Expert
June 19, 2008
This script was taken directly from the sample files loaded with Illustrator. The only change made was to add the NamedPreset line to utilize an existing PDF Preset. It works fine for me, maybe you have permission problems with the folder you are trying to write to.
Participant
June 19, 2008
Hi all,

When I run Larry Schneider's script I get this error:
http://img171.imageshack.us/img171/9745/clipboard1qt3.png

Has anyone seen this before ?
Known Participant
April 9, 2008
if (myFile.open("w")) {
myFile.close();
Participant
April 9, 2008
anyway to close the document after the files is saved as a pdf
Participant
November 12, 2007
arrrr...! alrite. Thanks
Known Participant
November 12, 2007
Probably because it's an Illustrator script.
Participant
November 12, 2007
Hi, I used your script to simulate a PDF Save, and it gives me the error "Error 1226, Enumerated Value expected" at line 64 which is sourceDoc.saveAs(targetFile, pdfSaveOpts).
I am using Photoshop CS3. Any idea why this is caused?
Participant
November 1, 2007
EDIT: Figured it out, thanks again!
Participant
November 1, 2007
Works great, thanks!