• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Print specific artboard (javascript)

Community Beginner ,
Mar 03, 2017 Mar 03, 2017

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;

}

TOPICS
Scripting

Views

667

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Mar 04, 2017 Mar 04, 2017

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;

}

Votes

Translate

Translate
Adobe
Enthusiast ,
Mar 04, 2017 Mar 04, 2017

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;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

LATEST

Thanks moluapple. Much appreciated. It makes sense it wasn't working then!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines