3

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?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
user3636943
  • 129
  • 1
  • 11
  • I know nothing about `enscript`. You should be able to `cat "$@" > $$.tmp` and then run `enscript $$.tmp -p $$.ps`. – choroba Jun 16 '14 at 10:02

1 Answers1

2

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.

lhf
  • 70,581
  • 9
  • 108
  • 149
  • However it doesn't respect columns parameter and doesn't split in 3 parts, if I ask it to. You will have to print 3 pages – user1041889 May 04 '20 at 14:46