Copy link to clipboard
Copied
Hi
I'm new to InDesign and ID scripting and am mainly trying to work with sample scripts to figure this out. how to assign print presets and the same ID path and same filename for a postscript file into ID.
Thanks
1 Correct answer
Hi @Balaji Murugesan , Also here’s an example that creates a print preset if it doesn’t already exist, and then sets the page range and file path via printPreferences:
var doc = app.activeDocument
//makes a print preset
var pp = makePrintPreset("PSPrint");
//the .ps file path
var sf = File (doc.filePath + "/" + doc.name + ".ps");
//sets the preset’s properties
//https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PrinterPreset.html
pp.properties = {ppd:"Adobe PDF 9.0",
...
Copy link to clipboard
Copied
Its all in the Document https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html and Application Object https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html
Print Preset you get via app.printerPresets.itemByName("Name"); The full Path is in Document.fullName start printing with Document.print(false, preset) https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html#d1e49521__d1e55139
Copy link to clipboard
Copied
Hello @Balaji Murugesan,
Take a look at the link below for a example...
https://adobe.scripting.indesign.narkive.com/1Qey2ePc/js-print-to-postscript-file
As mentioned by @grefel all the necessary scripting methods and properties can be found here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/index.html#$.html
Regards,
Mike
Copy link to clipboard
Copied
Hi @Balaji Murugesan , Also here’s an example that creates a print preset if it doesn’t already exist, and then sets the page range and file path via printPreferences:
var doc = app.activeDocument
//makes a print preset
var pp = makePrintPreset("PSPrint");
//the .ps file path
var sf = File (doc.filePath + "/" + doc.name + ".ps");
//sets the preset’s properties
//https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PrinterPreset.html
pp.properties = {ppd:"Adobe PDF 9.0",
paperSize:"Letter",
colorOutput: ColorOutputModes.COMPOSITE_CMYK,
printer: Printer.POSTSCRIPT_FILE,
flattenerPresetName:"[High Resolution]"};
//set the page range and .ps file path
//https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PrintPreference.html#d1e317722
doc.printPreferences.properties = {printFile: sf, pageRange: PageRange.ALL_PAGES}
doc.print(false, pp)
/**
* Makes a new print preset
* @ param preset name name
* @ return the new preset
*/
function makePrintPreset(n){
if (app.printerPresets.itemByName(n).isValid) {
return app.printerPresets.itemByName(n);
} else {
return app.printerPresets.add({name:n});
}
}

