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

How to create postscript file using Javascript

Explorer ,
Nov 23, 2022 Nov 23, 2022

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

TOPICS
Print , Scripting

Views

112

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
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 23, 2022 Nov 23, 2022

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", 
           
...

Likes

Translate

Translate
Contributor ,
Nov 23, 2022 Nov 23, 2022

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

 

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
community guidelines
Advisor ,
Nov 23, 2022 Nov 23, 2022

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

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
community guidelines
Community Expert ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

LATEST

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


 

 

 

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
community guidelines