Copy link to clipboard
Copied
Hello,
I'm trying to make a small script that loops through a folder, opens each document and prints artboard 3. I figured it was pretty trivial, but it's not
Here's the main part of the code. I set the print options and select artboard 2 (i assume the index starts at 0). But it's like Illustrator completely ignores any printoptions I set. It prints all of my artboards, no matter what I do. Also, I'm unable to debug in the Extendscript Toolkit, since it throws a run-time error.
Can anyone take a look at this?
Thanks in advance!
options = getPrintOptions( ); | |
for ( i = 0; i < files.length; i++ ) | |
{ | |
sourceDoc = app.open(files); // returns the document object; | |
sourceDoc.print(options); | |
} |
function getPrintOptions()
{
// Create the PDFSaveOptions object to set the PDF options
var printJobOptions= new PrintJobOptions();
var options = new PrintOptions();
options.jobOptions = printJobOptions;
options.printAllArtboards = false;
options.artboardRange = "2";
return options;
}
Hi, the artboard range is property of PrintJobOptions, not PrintOptions.
function getPrintOptions() {
// Create the PDFSaveOptions object to set the PDF options
var printJobOptions = new PrintJobOptions();
var options = new PrintOptions();
printJobOptions.printAllArtboards = false;
printJobOptions.artboardRange = "3"; // the index start at 1, not 0.
options.jobOptions = printJobOptions;
return options;
}
Copy link to clipboard
Copied
Hi, the artboard range is property of PrintJobOptions, not PrintOptions.
function getPrintOptions() {
// Create the PDFSaveOptions object to set the PDF options
var printJobOptions = new PrintJobOptions();
var options = new PrintOptions();
printJobOptions.printAllArtboards = false;
printJobOptions.artboardRange = "3"; // the index start at 1, not 0.
options.jobOptions = printJobOptions;
return options;
}
Copy link to clipboard
Copied
Thanks moluapple. Much appreciated. It makes sense it wasn't working then!