Print Automation via Scripting

I want to combine pages from many small jobs into one, relatively big job and print this job to a printer after reaching some limit. In other words I’m thinking about some sort of a FIFO buffer, which is filled by incoming pages. When number of pages in the buffer is greater than some amount, this number of pages should be flushed to a printer. In this case output job will always contain exact number of pages, and in case of N-Up layout, paper sheets will be fully filled by source pages.

Let’s see how it can be done with priPrinter.

priPrinter allows to run script for each new incoming job, so we are going to create script which will implement this buffer.

Script is a text file with .psf extension. This file should be placed in a special folder, so priPrinter will be able to execute it for each printout. Go to View tab, click on the Script button and select “View Files…”. Windows Explorer will be opened, let’s create file autoprint.psf.  Before going ahead and creating some real stuff will be better to check that script is recognized by priPrinter.  Very simple code could be:

MsgBox("Sheets available: " + layout.GetNumSheets());

After selecting this script in priPrinter preferences dialog, each print to to priPrinter should  display Message Box with number of paper sheets. For debugging reasons we can execute script from scripts menu or put it into quick access bar.


Final script will be:

if(doc && doc.numpages) // check for empty document
  const Min=5;
   local N= layout.GetNumSheets();
         { // check for the filling of the last page
         local paper0=layout.GetSheet(0);
         local paper1=layout.GetSheet(N-1);
               from=0, to=N-1,duplex=0});
         local i;
         local pagesToRemove=0;
         local paper=layout.GetSheet(i);

               local subDoc=doc.GetSubDoc(0);
               local c=subDoc.GetNumPages();
   }else break;


Comments are closed.