Search code examples
linuxpdfpostscriptenscript

Linux enscript multiple text files to a single PostScript file


I'm using this code to create a text file from our application, convert it to PostScript using enscript and then convert it to PDF.

function print_order
{

  ORDERFORM="Sales Order"
  PARAMFILE="$1.par"

  echo "OUTPUT_TO:FILE:$1.tmp" > $PARAMFILE
  echo "DOCUMENT:$1" >> $PARAMFILE
  echo "FORM_NAME:$ORDERFORM" >> $PARAMFILE

  win_print_order /par:$PARAMFILE

  enscript $1.tmp -p $1.ps
  ps2pdf $1.ps

}

In it's current state it works by running print_order 900100, this would create a 900100.pdf in the current directory.

But I am looking to be able to save multiple order prints in the same .pdf. Is it possible to pass multiple text files to enscript to create a single PostScript file of all order prints and from there a PDF?

For e.g. enscript $1.tmp,$2.tmp,$3.tmp -p $1.ps. Is this possible somehow?


Solution

  • Yes, enscript accepts multiple input files and outputs a single file. Try

    enscript -p $1.ps $1.tmp $2.tmp $3.tmp

    enscript accepts many options. See its man page.