HOWTO Convert (and Rotate) Windows PDFs

Introduction

I often have to swap documents in format, and have lately come across a wierd problem that must be a misinterpretation of either compression or text encoding.

Basically, s generated on machines (most notably those that use [Ghostscript\ variants like PrimoPDF) are unreadable in ‘s , displaying garbled text.

I still don’t know exactly why (it also happened with at least one -generated , to my utter bewilderment), but I’ve finally figured out how to view them correctly without installing Adobe’s (extremely) bloated Acrobat Reader on my s.

The Solution

The one solution that worked for me was to use Ghostscript to convert the files back into “raw” PostScript and then double-click on the resulting .ps file to force to re-encode it into format.

To do that, I got Ghostscript from Fink and used the following gs incantation:

$ gs -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=out.ps -f in.pdf

This invokes gs to batch render the input file to a PostScript file, which I then double-click to open in Preview.

Packing It Into a Single File

If (like me) you’d rather read through a single file, here’s a nice way to join files in a single converted output file:

$ gs -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=out.ps -c save pop -f \*.pdf

The save pop thing is the key here (remember PostScript is stack-based).

There’s also the option to use the pdfwrite device like so:

$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf -f \*.pdf

Two-Up Layouts

Another useful trick is to simulate a “side by side” layout (using psnup from the psutils package) after you convert the s to PostScript:

$ psnup -2 out.ps two-up.ps

You then simply open the PostScript file in and rotate it – bingo, instant side-by-side layout (great for wide screens).

Extracting Single Pages

My favorite, however, is this one:

gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=m
-dLastPage=n -sOutputFile=out.pdf in.pdf

(taken from here)

Update: One of these days I’ll try Easy N-Up, which requires a working install.

This page is referenced in: