The Newsletter of Big Blue and Cousins: The Greater Victoria PC Users' Association—Web Edition
Volume: 24 Number: 5, June 2007

Big Blue and Cousins

Open Source Corner June 2007

Trials and Tribulations...

by Stacey C. Falconer

O pen source software is available to meet almost any need, and virtually any platform. One of the drawbacks though, is the documentation.

The other day, I was trying to print a 2-up saddle stitched document on 11 x 17 inch paper. One would think that this would be an easy thing. I've been working at this problem for well over a year, pulling my hair out from time to time.

Open source software is available to meet almost any need, and virtually any platform. One of the drawbacks though, is the documentation.

Even in closed source environments it can be a daunting task. For our club newsletter, our printer, Fotoprint, takes our source PDF file, and does the imposition. This all happens behind the scenes, and all the editor of the month is left to do is inspect and sign-off the proof. Fotoprint uses a commercial imposition program—as does Adobe InDesign-CS2, which comes with an imposition/booklet building program. But, we're talking Open Source here!

Just imagine taking the staples out of one of our newsletters. To lay the pages out in a document layout program like Scribus can be a complex task, but the pages are still one after another, and cannot easily be printed with precision 2-up onto 11x17 sheets.

So, take the staples out, and look at the front and back cover. You will end up having something like image-1: back cover (page 20) on the left, and front cover (page 1) on the right.

On the backside of this sheet of paper, the page order is opposite: the inside front page (page 2) is on the left, and the inside back page (page 19) is on the right. The imposition order follows through the document: 20:1, 2:19, 18:3, 4:17, 5:16, ...10:11.

There is a utility than can do this imposition called psbook. Psbook is one of a set of utilities called PsUtils. PsUtils' home page is: http://knackered.org/angus/psutils.

The Win-32 binary can be found at: http://gnuwin32.sourceforge.net/packages/psutils.htm.

PsUtils only works on postscript files, so you have to be able to print your document as a postscript file. There are a variety of ways to do this, though it is easier in Linux than in Windows, since Linux and Unix operating systems assume that all printers are postscript printers, and by default it is very easy to save a postscript document. In the world of Windows, create an instance of a good generic postscript printer such as a Linotronic 330, and in the print dialogue, choose to save it to a file.

Needless to say, most of this also needs the Ghostscript suite of programs, available from: http://www.ghostscript.com. Ghostscript contains a full set of utilities that work with postscript and pdf files. By themselves, they can be hard to use. But open source programs such as Scribus use them for creating various types of PDF files.

Back to PsBook though. To use PsBook the command line use is:

psbook [ -q ] [ -ssignature ] [ infile [ outfile ] ],

where:

and must be a multiple of four (can be left out for a double sided 2-up booklet)-and, infile and outfile are of course, the input and output postscript file names.

In my case, the Linux command line looks like this:

In Linux, this is again easier than in MS-Windows; Linux automatically knows the path to psbook, but in Win-XP, it is not part of the path variable, and is quite long, but can be made easier by using the tab completion feature.

If everything goes well, the output file has the pages imposed in the proper printing order, and will insert empty pages at the end of the document when the total number of pages is not a multiple of four.

At this point, you have several choices: create a third document using psnup or pstops, resulting with half the pages with two pages on one output document page. This, in turn, gets converted to PDF document for printing.

If you have a high degree of printer control, then simply convert the document back to a PDF and print it on an 11x17" landscape spread, printing two sheets on each output page.

For much more control, then use pstops, an application in the psutils suite that allows rotation, scaling, and positioning control for laying out very complex page layouts, ready for commercial pre-press processing.

The command line that calls pstops looks something like this:

pstops [-q] -b][-wwidth][-hheight][-ppaper ][-dlwidth] pagespecs [ infile [ outfile ]].

The gory details can be found at:

http://www.knackered.org/angus/psutils/pstops.html

So, to arrange a 20 page postscript document that has been through PsBook, it might look something like this:

pstops -q -b -ptabloid 2:0L@1.0(11in,0)+1L@1.0(11in,8.5in) infile.ps outfile.ps

Where: -ptabloid is the output page size modifier, 0L rotates the first of every two pages counter-clockwise around the bottom left corner (the default 0,0 postscript location point), as does 1L for the second page, and the @1.0 is a scaling factor, that can scale the page by percentage. The (11in,0) and (11in,8.5) parameters shift the first page 11 inches to the right, and the second page 11 inches to the right, and up 8.5 inches.

I chose to write the commands into a batch script, sort of like the old DOS .bat files, that made debugging the script a lot easier.

In my case, it looks like this:

pstops '2:0+1(8.5in,0in)' stage1.ps stage2.ps

In this case, I didn't have to rotate or scale either page, and only had to move the second page over 8-1/2 inches. I also had to put single quotes around part of the arguments for use with Linux.

This looks a lot simpler and it is. But, therein lies the problem: the -ptabloid output page size modifier described in the documentation just wouldn't work. I always ended up with a grotesque PDF, with half a page here, half a page there, and only half the size it should be!

After pulling my my hair out in copious quantities, and beating my head against a brick wall repeatedly, I was almost ready to give up and start exploring some Java applications that purported to be able to do the same thing.

It was then that a faint memory from about a year ago came to mind: there may be environment variables that control the default size of an output page. I discovered in my Debian Linux system two files that had to do with paper size: /etc/Paper, and /etc/papersize. So, I chose to change the Tabloid/Ledger entries in /etc/Paper to position the tabloid paper landscape by default, and in /etc/papersize, I commented out the letter entry and added a ledger entry (as /root). It turns out that the second change is the only change I had to do.

Finally I converted the postscript file to a high quality press-ready PDF file with the following command:

ps2pdf -dEmbedAllFonts=true -dPDFSETTINGS=/prepress stage2.ps final.pdf

Herein lies a bit of a problem: any PDF created now wants to be 11x17 inches. No problem. Just a few tweaks here and there: a couple of special buttons in the menu to change the /etc/pagesize variable back and forth.

I found I didn't have to rotate any sheets (unless I wanted to print onto a smaller sheet size), the printer still chose to print on letter size paper with letter size document. Success at last. No more bloody foreheads, no more sleepless nights. Next project: a complex multi-pageup booklet for club course and activity promotion!


JUNE 2007
  • Photos to Graphics
  • Trials and Tribulations
  • Webman
  • Adobe InDesign CS3
  • PhotoImpact
  • GoodSync
  • Classic Photoshop Effects
  • Cover Story
  • Government House Fire Anniversary
  • Members' News
  • BB&C newsletter articles by Stacey C. Falconer