Andrew Stacey


About
Andrew Stacey
Information about my research, teaching, and other interests.

By: Andrew Stacey
Contact details


Andrew Stacey


blosxom icon


Fri, 26th Oct 2007 (HowDidIDoThat :: Hints)

Some Handy Hints for Postscript and PDF Files

Resizing postscript files.

Use pstops. For example the following command doubles-up the postscript file, removing blank space:

pstops -p a4 "2:0@.9L(24cm,-2cm)+1@.9L(24cm,12.85cm)" original.ps new.ps

This one uses psnup to put the slides printed by beamer four to a sheet.

psnup -pa4 -W363 -H273 -4 -d5 -m10 -b5 -c algobj.handout.ps > algobj.handout_nup.ps

Two Sides or Not Two Sides

For some reason, pstops mucks up duplex printing on my system. The solution that I've found is to insert a little text at the start of the postscript. Alternatively, these can be created as separate files and then concatenated with the document before being sent to the printer.

%!PS
statusdict /setduplexmode known
{statusdict begin true setduplexmode end} if {} pop

%!PS
statusdict /setduplexmode known
{statusdict begin true setduplexmode end} if {} pop
statusdict /settumble known
{statusdict begin true settumble end} if {} pop

Actually, it seems that only the bit in the braces is needed. The rest is probably just safety checks. An alternative to try is the following.

  <</Duplex true /Tumble true>> setpagedevice

Merge PDFs with ghostscript

This took me absolutely ages to find out about. I'd been trying all sorts of silly things, almost including trying to edit the PDFs directly!

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf \
source1.pdf source2.pdf source3.pdf etc.pdf

[Full link]
Last modified on:
Wed, 23rd Apr 2008