www.flickr.com
Showing posts with label ps2pdf. Show all posts
Showing posts with label ps2pdf. Show all posts

Wednesday, December 06, 2006

ps2pdf tip: How to Get Around the "broken" ps2pdf Arguments

I through hours with a ps2pdf problem. Thank God someone on the PostScript news group managed to help me out. Here's the story for posterity's sake.

I'm currently working on a LaTeX document with some photos in it. As I'm using the PowerDot class, which is incompatible with pdflatex, I need to convert all my images to EPS and use ps2pdf to get my final PDF document. On the first attempt, I used the command

ps2pdf file.ps file.pdf

and it worked, except that my photos came out all muddy, a result of over compression. So, I added the option to turn off compression,

ps2pdf -dEncodeColorImages=false file.ps file.pdf

and end up with the wonderfully obtuse error message

Error: /undefinedfilename in (false)
Operand stack:

Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1122/1686(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
MiKTeX GPL Ghostscript 8.54: Unrecoverable error, exit code 1

Ick.

It turns out that ps2pdf on Windows is a batch file, and batch files do not accept = in an argument. I had no idea that this was the case, but so it is. The solution, which is annoyingly absent in the documentation, is to replace = with #. Thus, the command on windows should be,

ps2pdf -dEncodeColorImages#false file.ps file.pdf

Like that, it works. And, I get my beautiful uncompressed photos in my document.