LINK="#3366FF" VLINK="#A000A0">

"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, http://www.linuxcare.com/


(?) Saving Trees: Laying up Multiple Pages per Printer Sheet

From Kong Liong Wong on Tue, 24 Aug 1999

Hi Answerguy

I'm running Solaris 2.6 and I'm using HP Jetadmin to administer my network HP laser printers. I've seen some organization who are able to print double pages on 1 sheet, with the time stamp, user as well as page number information neatly printed on the side. All I'm able to achieve now is printing 1 page per sheet and the formatting is ugly. I know I can use HP JetPrint to format my printing, but is there any other alternative way?

Please help

regards Kong Liong

(!) Is this a PostScript (TM) printer? If not you probably want to install a Ghostcript filter so that any PostScript that you send to the queue will be converted into your printer's native control language (some version of PCL for your HP).
Once that is accomplished it's very easy to configure your system to perform lay up as you describe. There's a program called 'mpage' which is commonly available with Linux distributions (you'll have to dig around to find the sources and compile them for Solaris). It's what you want.
'mpage' (http://gate.mesa.nl/pub/mpage) allows you to print 1, 2, 4 or 8 pages of text per side of a printed sheet. It does this by arranging the text into PostScript pages, and using the scaling and rotation features of PostScript to do the the layout.
'mpage' will add a small frame and a set of headers and footers to each printed sheet by default. It offers a number of options to disable or control these features. There's where you can get your filename, date, username and other information onto the output.
That's fine for text. However, your output is already in PostScript there's a program called 'pstops' which can do a PostScript to PostScript "conversion/translation" according to the parameters you specify. In that model you can provide it with parameters to scale each odd numbered page to 60%, rotate it ninety degrees, position it on an output sheet, take every even numbered page, scale it, rotate it another direction, add it to your output page, etc.
Notice that I gave an example of scaling/reducing the pages by less than 50% for a reason. It turns out that typical margins around your original pages are just a bit larger than they need to be when you do this layout. So scaling by 55% to 65% actually produces better looking and more readable output.
It can be a bit tricky to get your pstops parameters right. While I was writing my book I'd generate the PS file from my LaTeX .dvi files (using 'dvips'), then for some of the draft printouts I'd use 'pstops' to lay that out and 'gv' to select the even sheets (print those), and finally use 'gv' to toggle my sheet/page selections, turn the paper around and print the other sides. Most of the work was done by my book's Makefile (using 'make'). The result was that I could generate a full draft of my book while only using about 100 sheets of paper for 400 pages of writing. (Luckily my eyes are fine with the reduction).
Here's a sample 'pstops' command like the one that I used:
pstops -q -pletter "2:0L@.7(21cm,0)+1L@.7(21cm,11.6cm)" lsa.ps > /tmp/quarto.ps
(The term "quarto" is probably a misnomer here --- but that's what I called it in my Makefile).
While writing this I've been running a couple of web searches in my other 'screen' terminals (to get a good URL on mpage and to check the man page). While I was doing that I noticed that 'mpage' wasn't installed on my Debian box so I did an 'apt-get install' of that and found that it apparently supports layup of PostScript as well as text files. It's probably a newer version than I remember. Possibly it's just a feature that's been there for years, which I just never noticed before.
Considering how obtuse the 'pstops' command arguments can be perhaps you should just stick with 'mpage'.
'pstops' is part of the PSUtils page by Angus J. C. Duggan (http://www.tardis.ed.ac.uk/home/ajcd/psutils). There are a number of other free tools that he's provided which might be of interest to anyone with advanced printing needs. In fact, glancing at his web page I see that I probably should have been using 'psnup' instead of 'pstops' for what I was doing.
Oh well. Live long enough and you can learn lots. One of the reasons I spent so much time on TAG is that it gives me the incentive to double check the man pages and look up the web sites for packages that I use --- so I often learn new tricks in the process.
Incidentally I'd like to make a special notice on Angus' web page for the PSUtils package. It's beautiful. There's lots of very useful information about the package --- and he's taken the time to give credit to a large number of people that inspired his work or otherwise contributed to the package.
Thanks, Angus. (I've copied you, and the current maintainer of 'mpage' on this message. It will be published in the Linux Gazette Answer Guy column later this month. Linux Gazette is at http://www.linuxgazette.net --- which is odd since it's a free webazine with very little commercial sponsorship).

[ Given the number of commercial support bullets, and the generous hosting by SSC, I'm tempted to disagree on the amount of commercial sponsorship, though I must admit that I'm very pleased not to see it smothered with "regulation size" banner ads. -- Heather ]

In any event, Mr. Wong, I hope these tips will help you get what you want out of your printer. Of course, there are many other print filtering packages available for Linux and other forms of UNIX. I'm sure I'll learn about a few more, probably as a result of some future "Answer Guy" question.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 45 September 1999
HTML transformation by Heather Stern of Starshine Technical Services, http://www.starshine.org/


[ Answer Guy Index ] 1 2 3 4
5 6 7 8
9 10 11 12 13


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]