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

Known Participant
August 8, 2007
Hey Wendy,

You don't have the fix posted!
Participant
August 8, 2007
Hi
I was wondering if you could help, i am in a similar position to the above as a complete newby to this scripting thing. I have a preset that i would like to use as described above. I have gone thought the above steps and i get a different error.

it is on line 39 -

for ( i = 0; i < app.documents.length; i++ ) {

can you help?

Thanks
Participant
July 19, 2007
Both corrections did the trick! Thank you!
Larry G. Schneider
Community Expert
Community Expert
July 19, 2007
Wendy,

Try dropping the square brackets. I think they define the Illustrator defined presets. And as Ang$t said the p is lower case.

Larry
Participating Frequently
July 19, 2007
wendjcs
It could be a lowercase p as it refers to in the guide. eg:
options.pDFPreset
Also when I saved a custom preset it does not appear with brackets. So try options.pDFPreset = "SGS PDFs";
See if that works.
A