9 Replies Latest reply on Feb 13, 2017 12:07 PM by JJMack

    Defining Printer presets and Fit to page

    Stephanfo

      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:

       

      Capture d’écran 2017-02-12 à 22.55.55.png

       

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

       

      Thank you,

      Stef.

        • 1. Re: Defining Printer presets and Fit to page
          JJMack Most Valuable Participant

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

          • 2. Re: Defining Printer presets and Fit to page
            Stephanfo Level 1

            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.

            • 3. Re: Defining Printer presets and Fit to page
              JJMack Most Valuable Participant

              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.

              • 4. Re: Defining Printer presets and Fit to page
                Stephanfo Level 1

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

                • 5. Re: Defining Printer presets and Fit to page
                  JJMack Most Valuable Participant

                  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.

                  • 6. Re: Defining Printer presets and Fit to page
                    Stephanfo Level 1

                    This is already what this web app is providing. Orders are accessible on the backend, easy to read for printing (picture, format, quantity). However, switching from Lightroom/PS to a webpage is not easy. I agree, it is an extra, but the script can save my time, giving more opportunities to take picture of the event.

                     

                    Anyway, thank you for your contribution.

                     

                    Stef.

                    • 7. Re: Defining Printer presets and Fit to page
                      JJMack Most Valuable Participant

                      Stephanfo  wrote

                       

                      However, switching from Lightroom/PS to a webpage is not easy.

                      Where does that come in?  I do not even use Lightroom it is not required It does not support Layers and I do not know if it supports scripting. Simply write a Photoshop script that reads your orders.  Then open the image files and prints the sizes and qualities in the order or create image print files to be printed by your print service.

                      • 8. Re: Defining Printer presets and Fit to page
                        Stephanfo Level 1

                        Because the images are located in Lightroom at the first step (I investigated in the SDK, but no printing commands available). I thought about PS because of scripting capabilities.

                         

                        Anyway, the problem stay the same, I do not know how to select the paper size or printer profile in PS through a JSX script. And switching from one application to another, with one single screen, is not efficient from my POV.

                        • 9. Re: Defining Printer presets and Fit to page
                          JJMack Most Valuable Participant

                          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.