Copy link to clipboard
Copied
Hi all,
I have some troubles with an .ai script, its role is to export PDF in High and Low resolution at the same time.
Could someone help me please?
Here is the error flash message:
Error 1200: an illustrator error occurred: 1129270854 ('FNOC')
Line: 13
->
workingDoc.saveAs(lowResFile,Options);
And here is the script:
#target illustrator
for (x=0;x<app.documents.length;x++) {
var workingDoc = app.documents[x];
var workingDocFile = workingDoc.fullName;
var lowResFile = new File(workingDocFile.toString().replace(".ai","_LR.pdf"));
var Options = new PDFSaveOptions();
// populate these with your settings
Options.pDFPreset = '[Smallest File Size]';
workingDoc.saveAs(lowResFile,Options);
var highResFile = new File(workingDocFile.toString().replace(".ai","_HR.pdf"));
var highResOpts = new PDFSaveOptions();
// populate these with your settings
highResOpts.pDFPreset = '[High Quality Print]';
workingDoc.saveAs(highResFile,highResOpts); workingDoc.close(SaveOptions.DONOTSAVECHANGES);
alert( 'File has been saved as Low Resolution and High Resolution PDFs.'); }
For info, I have illustrator in French and the latest version. I tried to change '[Smallest File Size]' and '[High Quality Print]' with the french translation but it did'nt worked.
Thank you very much !
Copy link to clipboard
Copied
The script works for me, as long as there is a pre-existing .ai file. It will not work with a new unsaved document.
Regarding presets, if you click File > Save As, select Save type as "Adobe PDF" and click Save, you should get a "Save Adobe PDF" options window, which should have a dropdown list of Adobe PDF Presets. You can see whether or not you have [High Quality Print] and [Smallest File Size] or what you have instead.
Copy link to clipboard
Copied
you can also get a list of presets in this menu
Edit->Adobe PDF Presets...
Copy link to clipboard
Copied
Omg I don't know why but itf inally works !!! I'm wondering if it's because I deleted old versions of Illustrator... I had already changed the "[High Quality Print]" & "[Smallest File Size]" in french before but it didn't worked... except this morning. Computer science magic...
Thank you both for your comments!
Copy link to clipboard
Copied
Hi Vanerem,
it would be better if we could find a way to access the default PDF presets indepently from the locale version of Illustrator. I see the similar error with your code when I run it with the German version of Illustrator on Windows 10.:
Error: 1200, an Illustrator error occurred: 1129270854 ('CONF')
That said, let's look into the array of strings that app.PDFPresetsList returns.
With my German Illustrator 2022 this list begins with:
[Illustrator-Standard]
[Qualitativ hochwertiger Druck]
[PDF/X-1a:2001]
[PDF/X-3:2002]
[PDF/X-4:2008]
[Druckausgabequalität]
[Kleinste Dateigröße (PDF 1.6)]
[Kleinste Dateigröße]
So [Smallest File Size] would be app.PDFPresetsList[7].
And [High Quality Print] should be app.PDFPresetsList[1].
But of course the question is: could we reliably build on this order of strings?
And could it be that the order of strings is differently in other localized versions of Illustrator?
If I am using your code the way below, there is no error and the right PDF Export presets are used:
var workingDoc = app.activeDocument;
var workingDocFile = workingDoc.fullName;
var lowResFile = new File( workingDocFile.toString().replace(".ai","_LR.pdf") );
var Options = new PDFSaveOptions();
// populate these with your settings
Options.pDFPreset = app.PDFPresetsList[7];
try{
workingDoc.saveAs( lowResFile , Options );
}catch(e)
{
$.writeln("Error: "+e.number +", "+ e.message.toString() )
};
var highResFile = new File(workingDocFile.toString().replace(".ai","_HR.pdf"));
var highResOpts = new PDFSaveOptions();
// populate these with your settings
highResOpts.pDFPreset = app.PDFPresetsList[1];
try{
workingDoc.saveAs(highResFile,highResOpts);
}catch(e)
{
$.writeln("Error: "+e.number +", "+ e.message.toString() )
};
Regards,
Uwe Laubender
( Adobe Community Professional )