Copy link to clipboard
Copied
Hello,
i am creating a script to export .ai files to .png in different sizes and resolutions.
Im getting always an error that the options are wrong, incorrect.
Heres the invalid part of my code:
function createFolderAndSave(file,name,size,resolution)
{
// Create a EPS option object [height & width are doc size]
var epsOpenOptions = new EPSOpenOptions;
epsOpenOptions.antiAlias = true;
epsOpenOptions.height = size[0];
epsOpenOptions.width = size[1];
epsOpenOptions.mode = OpenDocumentMode.RGB;
epsOpenOptions.resolution = resolution;
epsOpenOptions.page = 1;
epsOpenOptions.constrainProportions = false;
open(file , epsOpenOptions); // error
var doc = app.activeDocument;
var replacer = new RegExp("-","g");
var docName = "ic_" + doc.name.replace(replacer,"_");
var myFolder = new Folder(destinationPath + "\\" + docName);
if(!myFolder.exists) myFolder.create();
var myFolder = new Folder(destinationPath + "\\" + docName + "\\" + name);
if(!myFolder.exists) myFolder.create();
doc.changeMode(ChangeMode.RGB);
var pngOptions = new PNGSaveOptions();
pngOptions.interlaced = true;
$.writeln(destinationPath + "\\" + docName + "\\" + name + "\\" + docName);
doc.saveAs( File( destinationPath + "\\" + docName + "\\" + name + "\\" + docName ) , pngOptions, false, Extension.LOWERCASE);
}
Maybe someone have an idea to solve this problem?
An Illustrator *.ai file for this purpose should be treated as PDF in format… In think most PDF readers will open them… So just swap your open options… Should you need the change mode? Your open options should have sorted this?
Copy link to clipboard
Copied
Solved problem myself,
i had to use PDFOpenOptions object instead of EPSOpenOptions object.
Copy link to clipboard
Copied
An Illustrator *.ai file for this purpose should be treated as PDF in format… In think most PDF readers will open them… So just swap your open options… Should you need the change mode? Your open options should have sorted this?