3

I create eps/png/pdf figures using python scripts. I want to use one lpr command to print several figures with 4 on each sheet of paper. The following command printed each figure on one fourth of a separate sheet.

lpr -o number-up=4 figure[0-9].eps 

How can I get these to print 4 per page?

cas
  • 1
  • 7
  • 119
  • 185
Steven C. Howell
  • 467
  • 1
  • 6
  • 14

2 Answers2

3

You probably need to provide just a single file for lpr to print. If your files are encapsulated PostScript, perhaps all you need to do is concatenate them with an intervening showpage command:

  for f in figure[0-9]; do cat "$f"; echo 'showpage'; done |
  lpr -o number-up=4 
meuh
  • 49,672
  • 2
  • 52
  • 114
2

psmerge and psnup from psutils should do what you want.

psmerge figure[0-9].eps | psnup -4 | lpr 

From the Description field in the Debian packaged version:

Description-en: PostScript document handling utilities

This collection of utilities is for manipulating PostScript documents. Page selection and rearrangement are supported, including arrangement into signatures for booklet printing, and page merging for n-up printing.

The following programs are included in psutils: epsffit, extractres, fixdlsrps, fixfmps, fixmacps, fixpsditps, fixpspps, fixscribeps, fixtpps, fixwfwps, fixwpps, fixwwps, getafm, includeres, psbook, psmerge, psnup, psresize, psselect, pstops, showchar

cas
  • 1
  • 7
  • 119
  • 185
  • Maybe I need to set something up before using this. The command printed a bunch of garbage text: `Unknown device: pswrite %%BeginProcSet: PStoPS 1 15 userdict begin [/showpage/erasepage/copypage]{dup where{pop dup load type/operatortype eq{ /PStoPSenablepage cvx 1 index load 1 array astore cvx {} bind /ifelse cvx 4 array astore cvx def}{pop}ifelse}{po p}ifelse}forall /PStoPSenablepage true def [/letter/legal/executivepage/a4/a4small/b5/com10envelope /monarchenvelope/c5envelope/dlenvelope/lettersmall/note /folio/quarto/a5]{dup where{dup wcheck{exch{}put}`.... – Steven C. Howell Jun 01 '16 at 13:53
  • can your python code produce plain postscript output instead of (or as well as) EPS? if so, try it with that. it shouldn't make a difference (eps is ps plus a thumbnail image), but it may. if it can't try converting it to plain ps first. BTW, rather than waste paper, redirect to a file and view in `gs` or something. – cas Jun 01 '16 at 13:59