Highlighted

Using a Script to Print PDF page from Illustrator

New Here ,
Jul 28, 2020

Copy link to clipboard

Copied

Our company has had a pallet that used to have a print PDF page, but it stopped working due to the printer changed networks. I have gotten the printerName updated but the script will not complete the print. The debugger is stoping on the activeDocument.print(options); I have tried countless entries and I cannot get the script to finish through. Below is a copy of the code that I have so far. What I want it to do is just print the active document to the printer with the scale of fit to page. Am I missing something on the code? Can someone help me with this? 

 

{var thisDoc = app.activeDocument;
options.printerName = "10.32.113.88_1 on VITOHFS01P"; //printer on network
var jobOptions = new PrintJobOptions();
var options = new PrintOptions();
options.fitToPage = true;
options.jobOptions = jobOptions;
activeDocument.print(options);
}

Adobe Community Professional
Correct answer by CarlosCanto | Adobe Community Professional

you need to add printer name value after declaring options variable. 

{var thisDoc = app.activeDocument;
var jobOptions = new PrintJobOptions();
var options = new PrintOptions();
options.printerName = "10.32.113.88_1 on VITOHFS01P"; //printer on network
options.fitToPage = true;
options.jobOptions = jobOptions;
activeDocument.print(options);
}

 

TOPICS
Scripting

Views

51

Likes

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

Using a Script to Print PDF page from Illustrator

New Here ,
Jul 28, 2020

Copy link to clipboard

Copied

Our company has had a pallet that used to have a print PDF page, but it stopped working due to the printer changed networks. I have gotten the printerName updated but the script will not complete the print. The debugger is stoping on the activeDocument.print(options); I have tried countless entries and I cannot get the script to finish through. Below is a copy of the code that I have so far. What I want it to do is just print the active document to the printer with the scale of fit to page. Am I missing something on the code? Can someone help me with this? 

 

{var thisDoc = app.activeDocument;
options.printerName = "10.32.113.88_1 on VITOHFS01P"; //printer on network
var jobOptions = new PrintJobOptions();
var options = new PrintOptions();
options.fitToPage = true;
options.jobOptions = jobOptions;
activeDocument.print(options);
}

Adobe Community Professional
Correct answer by CarlosCanto | Adobe Community Professional

you need to add printer name value after declaring options variable. 

{var thisDoc = app.activeDocument;
var jobOptions = new PrintJobOptions();
var options = new PrintOptions();
options.printerName = "10.32.113.88_1 on VITOHFS01P"; //printer on network
options.fitToPage = true;
options.jobOptions = jobOptions;
activeDocument.print(options);
}

 

TOPICS
Scripting

Views

52

Likes

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
Jul 28, 2020 0
Adobe Community Professional ,
Jul 28, 2020

Copy link to clipboard

Copied

you need to add printer name value after declaring options variable. 

{var thisDoc = app.activeDocument;
var jobOptions = new PrintJobOptions();
var options = new PrintOptions();
options.printerName = "10.32.113.88_1 on VITOHFS01P"; //printer on network
options.fitToPage = true;
options.jobOptions = jobOptions;
activeDocument.print(options);
}

 

Likes

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
Reply
Loading...
Jul 28, 2020 1
New Here ,
Jul 29, 2020

Copy link to clipboard

Copied

Thank you so much, it worked perfectly. 

Likes

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
Reply
Loading...
Jul 29, 2020 0
New Here ,
Jul 29, 2020

Copy link to clipboard

Copied

Quick question as far as this script. It works for what we are wanting, but I have noticed that it will print the file to the Printer as a PDF if it has not been printed before. But, if the artist prints the file to one of the other printers on the Network first before Using the script to print the PDF the Script will reprint the file to the printer they already printed it to instead of the one I have stated on the script. Is there a line that I need to add to the script so that it will print only to that Printer as a PDF no matter if its been printed somewhere else?

Likes

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
Reply
Loading...
Jul 29, 2020 0
Adobe Community Professional ,
Jul 29, 2020

Copy link to clipboard

Copied

I'm not sure what's causing that. Let's start by sampling the Printer Name, I assume it's correct because it does print. I want to test if it is not printing to printer x by accident.

 

this script will list all available printers names to the active document. It takes some time to get the printers information.

 

var docRef = app.activeDocument;
 
var textRef = docRef.textFrames.add();
var pL = app.printerList;
var iCount = pL.length;
 
textRef.contents = "Checking Printers... \r";
textRef.contents += "Open documents = " + documents.length + "\r" + "\r"

var arrayPrinterNames = [];
for (var i = 0; i < iCount; ++i) {
	arrayPrinterNames.push(pL[i].name);
    textRef.contents += pL[i].name + "\r";
    textRef.contents += "\tPS Level = " + pL[i].printerInfo.postScriptLevel + "\r";
    textRef.contents += "\tDevice resolution = " + pL[i].printerInfo.deviceResolution + "\r";
    textRef.contents += "\tInRIPSeparation support = " + pL[i].printerInfo.inRIPSeparationSupport + "\r" + "\r";
}
 
textRef.top = 600;
textRef.left = 200;
redraw();

 

 

Likes

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
Reply
Loading...
Jul 29, 2020 0