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

InDesign Script - Print with specific printer preset

New Here ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

Hi everyone.

 

I'm trying to write a script that would print pages directly from InDesign.

I see that can use Document.printPreferences.activePrinterPreset to select the general preset like below (sorry for the french interface):

printer 1.png

 

But I don't find a way to select a specific printer preset that would include tray settings, paper thickness and other stuff like here:

printer 2.png

 

Is that even possible? Maybe I am missing something, but I don't understand what benefits I would get from printing with a script if I cannot set printer-specific options.

 

Thank you in advance for any help!

TOPICS
Print , Scripting , UXP Scripting

Views

1.6K

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 ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

But I don't find a way to select a specific printer preset that would include tray settings, paper thickness and other stuff

 

Hi @Simon S. The PrintPreference and PrinterPreset extendscript objects are limited to the InDesign specific settings, so I don’t think there is a way to get at the printer specific settings, which are handled by the print driver software and OS. It looks like you are on a Mac, so you should be able to set the printer specific settings via AppleScript’s system events (see app.doScript()), but your script would not be cross platform.

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42253__d1e45802

Votes

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 ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

On windows you can create a copy of a printer and set all required preferences and then use it as a destination printer - maybe you can do the same on Mac? 

 

Votes

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 ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

quote

On windows you can create a copy of a printer and set all required preferences and then use it as a destination printer - maybe you can do the same on Mac? 


By @Robert at ID-Tasker

 

Nope, we Mac users are out of luck here.

Votes

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 ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

quote

Is that even possible? Maybe I am missing something, but I don't understand what benefits I would get from printing with a script if I cannot set printer-specific options.


By @Simon S.

 

You'll need to select the desired printer-specific options when you set up your InDesign print preset. Normally, they will be saved in your InDesign preset.

 

There's no way to select macOS print preset via scripts (not known to me at least).

 

Also, I don't recommend to use macOS print presets at all when you set up your InDesign presets. Mac's print presets are a buggy poorly designed mess. Just set up your print-specific settings without selecting any preset.

 

On Ventura, if you select a macOS print preset when setting up your InDesign preset, this macOS preset will become selected in ALL your other InDesign presets, thus changing all printer-specific setting you have set up previously in other InDesign presets.

 

I know you're on a pre-Ventura system. I'm not sure if macOS presets cause the same problem with InDesign presets on your system (there were quite a few changes on Ventura). Still, like I said, I believe it's better to avoid macOS presets altogether when working with InDesign - just select the desired printer-specific settings as part of your InDesign preset. 

Votes

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 ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

just select the desired printer-specific settings as part of your InDesign preset.

 

The print driver settings (e.g., Resolution, Paper Type, etc.) are not included in the InDesign Print preset—here the Printer Features for my large format Epson are not included in the InDesign Print Preset:

 

Screen Shot 1.png

 

All you can do with ExtendScript is set the printer and the PPD—none of the above are listed as properties in the API:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PrinterPreset.html

 

You can get at print settings via an AppleScript shell script, but it would take some advanced scripting:

 

https://talk.automators.fm/t/automate-printing-with-specific-print-settings-using-hazel-shell-script...

 

https://www.cups.org/doc/options.html

 

Votes

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 ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

quote

The print driver settings (e.g., Resolution, Paper Type, etc.) are not included in the InDesign Print preset—here the Printer Features for my large format Epson are not included in the InDesign Print Preset:


By @rob day

 

These settings will be saved within InDesign preset. When you set up your InDesign preset, click Printer... (just like in your screenshot) and set up the desired settings in the standard Print dialog. The settings will be saved as part of the InDesign preset.

Votes

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 ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

These settings will be saved within InDesign preset.

 

I’m not seeing that.

 

For example this InDesign Print preset named 7600 24 x 20 can use any of the listed print driver presets, which are printer specific and not included in the InDesign Print presets—1440 ROLL BD, 1440 ROLL UNI, etc in this case. The Print driver presets are saved via Print>Printer...>Presets>Save Current Settings as Preset..., while the InDesign presets are saved via the Print>Save Preset... button.

 

When using my 7600 24 x 20 preset, I can choose any of the listed driver presets at print time, and the chosen driver preset should be sticky, but I think @Simon S. wants to script the selection of a driver preset and bypass the dialog.

 

The driver Presets are not settable via the ExtendScript API—if I try to set the preset named 1440 ROLL BD via a script, I’ll get an error:

 

Screen Shot 2.png

Votes

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 ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

quote

The Print driver presets are saved via Print>Printer...>Presets>Save Current Settings as Preset..., while the InDesign presets are saved via the Print>Save Preset... button.

 

By @rob day

 

The settings you set in the standard macOS Print dialog (called via the Printer button) will be saved with your InDesign preset.

 

By way of example:

 

-Go to File > Print Presets > Define

-Double-click the desired print preset

-Click Printer

-Select a distinct option that was previously unchecked (for the test purpose).

-Click Print then OK everything to save your InDesign preset

 

Then re-open your InDesign preset and click Printer. You'll see that the option you've just checked remained selected. It is saved with your InDesign preset.

Votes

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
New Here ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

Thank you everyone for your answers and advices.

Unfortunately I don't know AppleScript, and what I'm trying to do isn't worth the effort.

 

As @rob day said, I'd just like to bypass the dialog to save a few more clicks. Currently, I'm exporting the document to PDF, then I choose my printer preset, page size, and print from Acrobat.

 

quote

The settings you set in the standard macOS Print dialog (called via the Printer button) will be saved with your InDesign preset.

 

By way of example:

 

-Go to File > Print Presets > Define

-Double-click the desired print preset

-Click Printer

-Select a distinct option that was previously unchecked (for the test purpose).

-Click Print then OK everything to save your InDesign preset

 

Then re-open your InDesign preset and click Printer. You'll see that the option you've just checked remained selected. It is saved with your InDesign preset.


By @leo.r

 

This is what I've done before creating this post, but it didn't work for me. The only difference is that I did it from "File > Print" and not "File > Print Presets > Define", but it should be the same, right ?

From what I remember, I clicked Printer, selected tray n°5, clicked OK, and saved my preset (which automatically applies). Then I clicked Printer again, and the tray was set back to "auto".

Votes

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 ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

Then I clicked Printer again, and the tray was set back to "auto".

 

Right, the setting of the tray is not scriptable—there isn’t a tray property in either the PrintPreference or PrintPreset ExtendScript objects.

Votes

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 ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

quote

Then I clicked Printer again, and the tray was set back to "auto".

 

Right, the setting of the tray is not scriptable—there isn’t a tray property in either the PrintPreference or PrintPreset ExtendScript objects.


By @rob day

 

The tray settings (among with other printer settings) are not scriptable - but they will normally be saved with InDesign preset if done correctly. Scriptability doesn't affect it.

 

I just described the process after running several extensive tests here on macOS Ventura. It worked like this on earlier systems, too.

Votes

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 ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

Here I have my print driver preset set to 1440 ROLL BD—the driver preset’s Resolution property is set to 1440dpi. With that driver setting I’ve made a new InDesign Preset named Epson 1440 DPI:

 

Screen Shot 13.png

 

If I load the InDesign EPSON 1440 DPI preset, and change print driver to a different preset and resolution, the print output will be at the lower resolution:

Screen Shot 15.png

 

If I make a new document, load the EPSON 1440 DPI Print Preset and check the driver preset it’s sticky to the last print driver setting:

 

Screen Shot 17.png

Votes

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 ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

quote

If I make a new document, load the EPSON 1440 DPI Print Preset and check the driver preset it’s sticky to the last print driver setting:


By @rob day

 

Yes, the behavior you witness exactly happens because of the issue with macOS print presets I described earlier.

 

The confusing and counter-productive behavior of macOS print presets makes it hard to figure out how to save print-specific settings within InDesign print presets.

 

Important rules:

 

-When you click Printer in order to initially set up the desired settings for your InDesign preset, you must ensure that no macOS preset is selected (it should be either None or Default Settings).

 

-However, if you wish to edit the printer-specific settings you already saved with your InDesign preset, you'll have to perform yet more convoluted procedure. Mac's print presets are selected on the system level (that is, once you select a macOS print preset, it becomes selected in all apps.) But if you deselect macOS print preset in InDesign while editing settings saved with your existing InDesign preset, you'll reset your saved settings and they'll be lost. So you'll have to deselect macOS print preset in another app, then print something from there to make sure the change is saved (that is, that no macOS print preset is selected across the system), then edit the settings you saved with your InDesign preset (via the Printer button).

 

Clear as mud? Well that's macOS print automation in a nutshell. From hard to next to impossible to achieve. That's one of the reasons why InDesign and other professional tools use their own print interfaces.

 

But by following all the workarounds and steps I described, it should be possible to save printer-specific settings within InDesign presets. 

Votes

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 ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

@rob day :

 

P.S. In addition to my previous post, if you're interested, here's some hard evidence:

 

You can export your InDesign print preset, then open it in a text editor.

 

You'll see that all printer-specific settings are saved as a humanly-readable XML string.

 

Here's an example:

 

I selected Envelope Tray and 6 Pages Per Sheet and saved it within my InDesign print preset as described earlier:

 

leor_0-1685505153808.png

 

These settings can be found inside the InDesign preset when you open it in a text editor:

 

leor_1-1685505312571.png

leor_2-1685505339772.pngleor_3-1685505398982.png

 

InDesign will (or, at least, should) use these settings if you print using this InDesign preset.

 

That's, again, if the user will go through all the convoluted hoops I described earlier that are required to properly save the desired printer-specific settings within InDesign preset. This process is neither intuitive nor user-friendly and, unfortunately, most users will never figure it out. 

 

 

Votes

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
New Here ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

quote

Clear as mud?

 

 Indeed, you’ve clearly lost me here! But I think I get some of the ideas though.

 

So I did some tests today, and I don’t really know what to think.

I tried your method to make a preset using Default Settings. It worked for most settings, but for some reason the recto (single-sided) was set back to recto verso (double-sided) everytime, while the color/grayscale setting was saved, as you can see in the video below:

 

Then I don’t know what happened, but my Default Settings kept all the random settings I edited for testing purposes. Maybe it’s normal but that scared me, so I gave another chance to printer-specific presets.

 

I created two InDesign presets “Tray1_SingleSided” and “Tray5_DoubleSided”, each of them saved with their own printer-specific preset. I tried several times to print alternatively with each InDesign preset and the result was as expected.

 

However, when you look at the video below, you may think it wouldn’t work:

 

But I clicked Cancel, then printed and it worked as expected.
So I guess you were right that the printer-specific preset is saved within the InDesign preset, but I have the feeling that we can’t really check it by clicking on Printer.
Now I guess the tricky part could be if I want to edit a preset, but I will probably give a try this way.

Votes

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 ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

LATEST

 

quote

However, when you look at the video below, you may think it wouldn’t work:

 

But I clicked Cancel, then printed and it worked as expected.


By @Simon S.

 

Yes, that's exactly because of the problem with macOS presets I described.

 

leor_0-1685568394723.png

 

When you click Printer, you'll see the standard Print dialog with the last selected macOS preset loaded - NOT necessarily the settings saved with your InDesign preset. So yes, it's totally misleading. Since you clicked Cancel, you didn't change the settings saved with your InDesign preset so everything printed as expected.

 

You can do the following test:

 

-First, open the standard Print dialog in another app (Preview, for example), select the Tray1_SingleSided preset and click Print (to make sure the change is saved). (Cancel printing or use a virtual printer if you don't want to waste paper.)

 

-Then click Printer in InDesign's Print dialog: you'll see that the Tray1_SingleSided preset is now selected there, too.

 

That's because, like I mentioned, once you select a macOS print preset it becomes selected on the system level (across all apps, including InDesign). When you click Printer in InDesign, this selection will not be affected regardless of the actual settings saved with your InDesign preset.

 

So, once again, it can be totally misleading.

 

That's why I suggested to not rely on macOS print presets when saving your settings in InDesign. Then you can at least consistently see the actual saved settings when no macOS preset is selected (None or Default Settings). At least that's what I witness here on Ventura - but as far as I understand you had some issues with this approach, too.

 

 

Note:

There's also an option to reset the Presets menu to Default Settings every time after printing (Edit Preset List menu in the standard Print dialog):

 

leor_1-1685570066817.png

 

This can potentially help view the saved settings in InDesign consistently as the Presets menu will be always cleared automatically.

 

It's all a big mess.

 

 

Votes

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 ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

quote

 

This is what I've done before creating this post, but it didn't work for me. The only difference is that I did it from "File > Print" and not "File > Print Presets > Define", but it should be the same, right ?

From what I remember, I clicked Printer, selected tray n°5, clicked OK, and saved my preset (which automatically applies). Then I clicked Printer again, and the tray was set back to "auto".


By @Simon S.

 

If you do everything as I described, you should be able to save the desired printer settings with InDesign preset. 

 

First, please try the File > Print Presets > Define routine. It's a better way to edit an existing preset.

 

Second, make sure you don't have any macOS preset selected when you click Printer. Like I mentioned in my first post, in the context of InDesign print automation macOS print presets are your enemies.

 

If you do have a macOS print preset selected, remove it (select Default Settings) then save your InDesign preset.

 

Then go back to the Printer dialog, ensure that no macOS print preset is selected, then define the desired printer settings. Normally, they should be saved with your InDesign preset.

 

If you're still unable to save them, please let me know.

Votes

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
New Here ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

Thank you for those details. I can't try now but I sure will when I get back to work in a few days.

Votes

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