Hi,
I am trying to figure out how I can use a variable as the target for a Save as PDF option in Illustrator javascript. the variables work fine where there is no enumerated value for the property i.e. opts.generateThumbnails but I can figure out how to get it working opts.compatibility or other properties with enumerated values using a variable as the definition.
The code snippet example below will always give an 'Enumerated Value expected' error when run for the opts.colorCompression option even though the string is correct.
If I define the opts as opts.colCompression = compressionQuality.AUTOMATICJPEGHIGH then everythings works
Does anyone know of how I can define the compressionQuality.AUTOMATICJPEGHIGH as a variable the will work
Tks
Code snippet
opts = new PDFSaveOptions();
opts.compatibility = PDFCompatibility.ACROBAT5;
opts.generateThumbnails = thumbnailValue;
opts.preserveEditability = editingValue
opts.optimization = optimizationValue;
opts.colorCompression = colCompressionDefault;
// default value is defined at the start of the script as:-
// var colCompressionDefault = 'compressionQuality.AUTOMATICJPEGMAXIMUM';
alert("Options Color Compression = " + opts.colorCompression);
for (x = 0; x < doc.artboards.length; x++ )
{
doc.artboards.setActiveArtboardIndex( x );
var artboardName = doc.artboards[x].name;
if ( ( artboardName.match( /^Printed/i ) ))
{
opts.artboardRange = x+1;
expFile = File( destFolder + '/'+ nameString + '-' + doc.artboards[x].name + '.pdf' );
doc.saveAs ( expFile, opts ); //This is the lien that fails
}
}
//close the open document
sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
I am trying to figure out how I can use a variable as the target for a Save as PDF option in Illustrator javascript. the variables work fine where there is no enumerated value for the property i.e. opts.generateThumbnails but I can figure out how to get it working opts.compatibility or other properties with enumerated values using a variable as the definition.
The code snippet example below will always give an 'Enumerated Value expected' error when run for the opts.colorCompression option even though the string is correct.
If I define the opts as opts.colCompression = compressionQuality.AUTOMATICJPEGHIGH then everythings works
Does anyone know of how I can define the compressionQuality.AUTOMATICJPEGHIGH as a variable the will work
Tks
Code snippet
opts = new PDFSaveOptions();
opts.compatibility = PDFCompatibility.ACROBAT5;
opts.generateThumbnails = thumbnailValue;
opts.preserveEditability = editingValue
opts.optimization = optimizationValue;
opts.colorCompression = colCompressionDefault;
// default value is defined at the start of the script as:-
// var colCompressionDefault = 'compressionQuality.AUTOMATICJPEGMAXIMUM';
alert("Options Color Compression = " + opts.colorCompression);
for (x = 0; x < doc.artboards.length; x++ )
{
doc.artboards.setActiveArtboardIndex( x );
var artboardName = doc.artboards[x].name;
if ( ( artboardName.match( /^Printed/i ) ))
{
opts.artboardRange = x+1;
expFile = File( destFolder + '/'+ nameString + '-' + doc.artboards[x].name + '.pdf' );
doc.saveAs ( expFile, opts ); //This is the lien that fails
}
}
//close the open document
sourceDoc.close(SaveOptions.DONOTSAVECHANGES);