在Mac OSX上使用Javascript在Illustrator的特定托盘上打印
我是为Illustrator开发Javascript的新手,我需要使用Javascript优化打印操作。 我正在使用Illustrator开发MacOSX,我必须在不同的托盘上从同一台网络打印机打印纸张和透明胶片。 我已经写了一个Javascript代码,它的工作。。。仅在Illustrator中最后选定的打印机上。 我可以为Illustrator打印对话框中的每个可用参数选择打印选项,但纸盘是Illustrator打印机设置的一部分,我无法定义必须在Javascript中打印的纸盘。 我尝试在OSX中复制打印机,并强制在特定的透明纸盘上进行设置,但由于脚本总是在Illustrator中选择的最后一个使用的打印机纸盘上打印,因此无法工作 OSX中的打印机列表: 纸张预设: 透明胶片的预设:在Mac OSX上使用Javascript在Illustrator的特定托盘上打印,javascript,printing,adobe-illustrator,tray,Javascript,Printing,Adobe Illustrator,Tray,我是为Illustrator开发Javascript的新手,我需要使用Javascript优化打印操作。 我正在使用Illustrator开发MacOSX,我必须在不同的托盘上从同一台网络打印机打印纸张和透明胶片。 我已经写了一个Javascript代码,它的工作。。。仅在Illustrator中最后选定的打印机上。 我可以为Illustrator打印对话框中的每个可用参数选择打印选项,但纸盘是Illustrator打印机设置的一部分,我无法定义必须在Javascript中打印的纸盘。 我尝试在
var Doc = app.activeDocument;
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
var fileref = Doc.name;
var PrintRicoh = app.printerList[1].name;
var PrintRicohFilm = app.printerList[3].name;
var PaperA3 = printerList[1].printerInfo.paperSizes[0];
alert (PrintRicoh);
alert (PrintRicohFilm);
var PrintBox = new Window('dialog', "Print Dialog Box",);
FileNameBox = PrintBox.add ('panel', undefined, "File Name");
FileNameBoxgroup = FileNameBox.add('group', undefined);
FileNameBoxgroup.orientation = 'row';
FileNameBoxgroup.alignment = [ScriptUI.Alignment.LEFT,ScriptUI.Alignment.TOP];
var FileNametxt = FileNameBoxgroup.add('statictext', undefined, "File Name : ");
FileNametxt.size = [ 105,20 ];
var FileName = FileNameBoxgroup.add ('edittext', [undefined, undefined, 200, 20], (fileref) );
FileName.active = false;
PrintBox.panel = PrintBox.add ('panel', undefined, "Printer Destination");
PrintBox.panel.group = PrintBox.panel.add('group', undefined);
PrintBox.panel.group.orientation = 'row';
PrintBox.panel.group.alignment = [ScriptUI.Alignment.LEFT, ScriptUI.Alignment.TOP];
var PrinterNametxt = PrintBox.panel.group.add('statictext', undefined, "Printer Name : ");
PrinterNametxt.size = [ 105,20 ];
var PrinterName = PrintBox.panel.group.add ('edittext', [undefined, undefined, 200, 20], (PrintRicoh));
PrinterName.active = false;
PaperSizeBox = PrintBox.add ('panel', undefined, "Paper Size");
PaperSizegroup = PaperSizeBox.add('group', undefined);
PaperSizegroup.orientation = 'row';
PaperSizegroup.alignment = [ScriptUI.Alignment.LEFT, ScriptUI.Alignment.TOP];
var PaperSizetxt = PaperSizegroup.add('statictext', undefined, "Paper Type : ");
PaperSizetxt.size = [105,20];
var PaperSize = PaperSizegroup.add ('edittext', [undefined, undefined, 200, 20], (PaperA3) );
PaperSize.active = false;
PresetBox = PrintBox.add ('panel', undefined, "Printer Preset");
PresetBoxgroup = PresetBox.add('group', undefined);
PresetBoxgroup.orientation = 'row';
PresetBoxgroup.alignment = [ScriptUI.Alignment.LEFT, ScriptUI.Alignment.TOP];
var Presettxt = PresetBoxgroup.add('statictext', undefined, "Printer Preset : ");
Presettxt.size = [105,20];
var Preset = PresetBoxgroup.add ('dropdownlist', [undefined, undefined, 200, 20], ["Paper" , "Film" , "Both", "Separation"] );
Preset.active = true;
Preset.selection = 0;
PrintBox.closebtn = PrintBox.add('button', undefined, "OK", {name:'OK'});
PrintBox.closebtn.onClick = function(){
box.close();
}
PrintBox.show();
var PresetText = Preset.selection.text;
switch (PresetText) {
case 'Paper':
var options = new PrintOptions();
var colorOptions = new PrintColorManagementOptions();
colorOptions.colorProfileMode = PrintColorProfile.PRINTERPROFILE;
colorOptions.intent = PrintColorIntent.RELATIVECOLORIMETRIC;
options.colorManagementOptions = colorOptions;
var sepOptions = new PrintColorSeparationOptions();
sepOptions.convertSpotColors = false;
sepOptions.overPrintBlack = true;
sepOptions.colorSeparationMode = PrintColorSeparationMode.COMPOSITE;
options.colorSeparationOptions = sepOptions;
var coordinateOptions = new PrintCoordinateOptions();
coordinateOptions.fitToPage = false;
coordinateOptions.position = PrintPosition.TRANSLATECENTER;
coordinateOptions.orientation = PrintOrientation.AUTOROTATE;
options.coordinateOptions = coordinateOptions;
var flatOpts = new PrintFlattenerOptions();
flatOpts.convertStrokesToOutlines = true;
flatOpts.convertTextToOutlines = true;
flatOpts.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
options.flattenerOptions = flatOpts;
var printJobOptions = new PrintJobOptions();
printJobOptions.designation = PrintArtworkDesignation.ALLLAYERS;
printJobOptions.reverse = false;
printJobOptions.printArea = PrintingBounds.ARTWORKBOUNDS;
printJobOptions.copies = 1;
printJobOptions.name = fileref;
printJobOptions.printAllArtboards = true;
options.jobOptions = printJobOptions;
var printPaperOpts = new PrintPaperOptions();
//printPaperOpts.name = PaperA3;
options.jobOptions = printJobOptions;
options.paperOptions = printPaperOpts;
options.printerName = PrintRicoh;
options.printPreset = "Print";
Doc.print(options);
// function exportFileAsEPS(fileref) {
// var EPSSaveOpts = new epsSaveOptions();
// epsSaveOptions.cmykPostScript = true;
// epsSaveOptions.embedAllFonts = true;
// epsSaveOptions.embedLinkedFiles = true;
// epsSaveOptions.includeDocumentThumbnails = true
// epsSaveOptions.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
// epsSaveOptions.postScript = EPSPostScriptLevelEnum.LEVEL2;
// epsSaveOptions.preview = EPSPreview.COLORTIFF;
// epsSaveOptions.saveMultipleArtboards = true;
// Doc.saveAs (fileref,EPSSaveOpts);
// }
// Doc.saveAs (fileref,EPSSaveOpts);
break;
case 'Film':
var options = new PrintOptions();
var colorOptions = new PrintColorManagementOptions();
colorOptions.colorProfileMode = PrintColorProfile.PRINTERPROFILE;
colorOptions.intent = PrintColorIntent.RELATIVECOLORIMETRIC;
options.colorManagementOptions = colorOptions;
var sepOptions = new PrintColorSeparationOptions();
sepOptions.convertSpotColors = false;
sepOptions.overPrintBlack = true;
sepOptions.colorSeparationMode = PrintColorSeparationMode.COMPOSITE;
options.colorSeparationOptions = sepOptions;
var coordinateOptions = new PrintCoordinateOptions();
coordinateOptions.fitToPage = false;
coordinateOptions.position = PrintPosition.TRANSLATECENTER;
coordinateOptions.orientation = PrintOrientation.AUTOROTATE;
options.coordinateOptions = coordinateOptions;
var flatOpts = new PrintFlattenerOptions();
flatOpts.convertStrokesToOutlines = true;
flatOpts.convertTextToOutlines = true;
flatOpts.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
options.flattenerOptions = flatOpts;
var printJobOptions = new PrintJobOptions();
printJobOptions.designation = PrintArtworkDesignation.ALLLAYERS;
printJobOptions.reverse = false;
printJobOptions.printArea = PrintingBounds.ARTWORKBOUNDS;
printJobOptions.copies = 1;
printJobOptions.name = fileref;
printJobOptions.printAllArtboards = true;
options.jobOptions = printJobOptions;
var printPaperOpts = new PrintPaperOptions();
//printPaperOpts.name = PaperA3;
options.jobOptions = printJobOptions;
options.paperOptions = printPaperOpts;
options.printerName = PrintRicohFilm;
options.printPreset = "Film";
Doc.print(options);
//Doc.save ();
break;
case 'Both':
var options = new PrintOptions();
var printJobOptions = new PrintJobOptions();
options.jobOptions = printJobOptions;
options.printPreset = "Print";
Doc.print(options);
var options = new PrintOptions();
var printJobOptions = new PrintJobOptions();
options.jobOptions = printJobOptions;
options.printPreset = "Film";
Doc.print(options);
//Doc.save ();
break;
case 'Separation' :
var options = new PrintOptions();
var printJobOptions = new PrintJobOptions();
printJobOptions.designation = PrintArtworkDesignation.ALLLAYERS;
printJobOptions.reverse = false;
printJobOptions.printArea = PrintingBounds.ARTWORKBOUNDS;
printJobOptions.copies = 1;
printJobOptions.name = fileref;
printJobOptions.printAllArtboards = true;
options.jobOptions = printJobOptions;
options.printPreset = "Separation";
Doc.print(options);
// function exportFileAsEPS(fileref) {
// var EPSSaveOpts = new epsSaveOptions();
// epsSaveOptions.cmykPostScript = true;
// epsSaveOptions.embedAllFonts = true;
// epsSaveOptions.embedLinkedFiles = true;
// epsSaveOptions.includeDocumentThumbnails = true
// epsSaveOptions.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
// epsSaveOptions.postScript = EPSPostScriptLevelEnum.LEVEL2;
// epsSaveOptions.preview = EPSPreview.COLORTIFF;
// epsSaveOptions.saveMultipleArtboards = true;
//}
break;
Doc.saveAs (fileref,EPSSaveOpts);
}您好,欢迎光临,如果您能向我们展示您的Javascript,我想这可能更容易解决。如果代码看起来。。。单数,但我是全新的编码没有培训或形成。。。只有自学。。。