[iBook] Printing to custom page sizes?

Larry Kollar kollar at alltel.net
Fri May 26 18:58:56 PDT 2006


About a week ago, I asked about printing to 3"x5" index cards. Here's  
how I got it to work -- it's a bunch of command-line hackery, so move  
on if you don't want to hear about it. It requires both pstools and  
ghostscript to be available on the iBook.

First, convert the PDF to PS, using pdf2ps file.pdf file.ps

Now comes the fun part. In a bash shell:

$ for (( i=1; i<=84; ++i )); do> psselect -p${i} file.ps pg${i}.ps
 > eps2eps pg${i}.ps pg${i}.eps
 > rm pg${i}.ps
 > done

Replace "84" in the first line with the number of pages in your  
document. This leaves you with one EPS file per page.

Now the *really* fun part. Create a file of groff commands to put  
each index card at the top of an otherwise blank page:

$ ls *.eps | awk '{print ".bp"; print ".PSPIC $0";}' >cards.t

You'll have to edit the cards.t file, unless it's less than 10 pages,  
to move pages 2 through 9 to the right spots. After you've done that,  
run it off:

$ groff cards.t > lpr

The above works if you have a PostScript printer. Otherwise, you  
might need:

$ groff cards.t > cards.ps
$ ps2pdf cards.ps cards.pdf
$ open cards.pdf

This opens Preview (or your default PDF viewer) showing your print  
job. Print as you normally would.

Easier done than said, once you figure out how to do it. Depending on  
your printer, you *might* have to put a ".sp" command between each  
".bp" and ".PSPIC" -- in my case, the printer's top margin worked out  
just right.

All goes to show, you can't keep a good hacker down -- and mediocre  
ones like me, you can only slow down a little. :-)

--
Larry Kollar     k  o  l  l  a  r  @  a  l  l  t  e  l  .  n  e  t
Unix Text Processing: "UTP Revival"
http://unixtext.org/




More information about the iBook mailing list