30 March 2009

prn to pdf

Lets say that you work in an environment where you occasionally have to deal with Microsoft Office documents. You need to convert these to .pdf's so everyone can read them. Openoffice does the job admirably most of the time but sometimes it crashes or just messes up the layout. There is a (slightly circuitous) way of converting any printable windows document to a pdf file that doesn't require having to install any special dodgy PDF converter software.

You will need:
  • A Windows installation that can read & print the document
  • A postscript printer driver for the Windows install (see below)
  • A linux installation with ps2pdf installed
If you don't already have one installed, you can get postscript printer drivers here or you can try following the steps here. Once you have the drivers installed, the steps are:
  • On windows, go to print your document
  • When the print dialog comes up, make sure you select your postscript printer

  • Also select the 'print to file' option
  • Hit print; a dialog will come up specifying the file you want to write to. For arguments sake, lets call it wombat.prn
  • Copy this file to somewhere you can get to on linux
  • On linux, open up a terminal where wombat.prn lives, and run:
ps2pdf wombat.prn wombat.pdf

...and now you have a shiny new .pdf. There are a ton of options you can use in ps2pdf to tweak document size and quality - see here.

No comments: