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);
}