Skip to main content
Participant
February 12, 2017
Question

Defining Printer presets and Fit to page

  • February 12, 2017
  • 3 replies
  • 1079 views

Hi all,

I'm working on a script generator to ease the printing of pictures from a PHP web gallery available during weddings (FYI, this is an open source web application with Symfony 3.2, doc will arrive soon, only in French for the moment: https://github.com/stephanfo/AWG).

After a selection, I would like to generate a JSX file for a batch printing (copies, different sizes). I can open the picture, select the printer, but I do not know how to select the "fit to page" in PS and "Printer Preset", before to print.

This is my current code, for a single picture:

var docPath1 = '~/Desktop/todo.png';

var doc1 = app.open(File(docPath1));

var ps = doc1.printSettings;

ps.activePrinter = "Dai Nippon Printing DP-DS620";

ps.copies = 2;

// Here I would like:

// - 1 Select "fit to page" PS option

// - 2 Select the printer preset with the good paper size (defined from printers configuration before)

// 2 options after

// executeAction( charIDToTypeID('Prnt'), undefined, DialogModes.ALL ); // To check before to print

// doc1.print(); // To print directly

I would like to set the presets like in the screenshot below:

Can you please help me ? I went through the JSX doc, but nothing relevant came to me.

Thank you,

Stef.

This topic has been closed for replies.

3 replies

JJMack
Community Expert
Community Expert
February 13, 2017

To set Photoshop's Print dialog settings via jsx you would need to use Action Manager code.  To set your print device driver setting may not be possible via Photoshop scripting you may need to use some utility like autohotkey.  There is more then Photoshop involved when it come to printing.  You may just want to create Print Files using Photoshop.  Then use a utility like qprinter to print the files created. A print utility may be able to handle your printer better than Photoshop.  Your Image files are in you Operating system files system.  You may need to consult Lightroom's  library system to know where they are I do not know I do not use Lightroom. If Lightroom's databases can be queried from JavaScript you may be able to do the in a Photoshop script. I do not know for Adobe's Photoshop uses its own scripting plug-in I do not know how complete  the JavaScript part of it is. It support AppleScript and VSB as well as JavaScript.

JJMack
JJMack
Community Expert
Community Expert
February 13, 2017

I see no problem if your web application generates a jsx to print the images and sent it to your remote machine for you to run. If instead the web application sent the jsx to your machine to some running service that would use your photoshop to size and print the orders would be a problem.

JJMack
StephanfoAuthor
Participant
February 13, 2017

Good. Regarding the issue itself, do you have any idea?

JJMack
Community Expert
Community Expert
February 13, 2017

I do not develop web applications.  IMO its a print order.  Your web  app should create a picture order.  A list containg Image Id sizes and quaities.  IMO it should not try to create a java svript.  These orders would somehow be set to you perhaps via email.  On your photoshop machine you would have a Photoshop script that would process these orders.  I think you are over thinking what your web app has to do.

JJMack
JJMack
Community Expert
Community Expert
February 13, 2017

I think making Photoshop printing a web service from a web gallery would violate your licence with Adobe.  Have you check with Adobe?

JJMack
StephanfoAuthor
Participant
February 13, 2017

In my idea, the JSX generator will allow to download the JSX file generated and after need manual double click and check before printing (no direct print from PHP to PS, on a different machine, not sure we can consider this as a web service). But honestly, in case I code this for this project, I do not see what can be the issue for Adobe, except to motivate people to buy a PS licence. One more comment, this gallery system is not available on internet, only local/private web network and for a limited time (1 to 2h maximum).

Regarding my issue, do you have any idea?

thank you, Stef.