Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My computer runs on Windows 7 with MikTeX 2.9 and GhostScript 9.02 installed.

I am still confused why do I have to invoke gswin64c.exe rather than ps2pdf.exe to convert ps to pdf?

The switches I want to use are

 -sPAPERSIZE=a4 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=filename.pdf -c save pop -f filename.ps

When I use ps2pdf.exe with the switch above, it got error message as follows.

enter image description here

Experiment results based on Philippe's comment as follows.

Not working syntax:

  • ps2pdf -sPAPERSIZE=a4 in.ps out.pdf
  • ps2pdf -sPAPERSIZE#a4 in.ps

Working syntax:

  • ps2pdf -sPAPERSIZE#a4 in.ps out.pdf
  • ps2pdf in.ps out.pdf with top margin gets cropped.
  • ps2pdf in.ps with top margin gets cropped.
share|improve this question
    
What is the error message? Which distribution and OS do you use? –  Caramdir Jun 4 '11 at 16:53
    
I am no longer interested in this question because I have migrated to TeX Live 2010. –  xport Jul 11 '11 at 5:12
add comment

1 Answer

up vote 6 down vote accepted

You don't have to use gswin64c directly. ps2pdf should work. And it does work for me. (TeX Live 2011)

On the other hand, ps2pdf command is actually a script (ps2pdf.exe in TeX Live calls a Lua script ps2pdf.tlu) which calling GhostScript, say, gswin32c.exe or gswin64c.exe.

Usage: ps2pdf [options] (input.[e]ps|-) [output.pdf]

However, the option you use does fails. -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite are defined in ps2pdf script, you don't need them. -sOutputFile can also be replaced. It's safe if you use them, however.

I'm not sure what -c save pop mean. It seems that this option cause the problem. Without this option, everything is Okey.

share|improve this answer
    
I tried ps2pdf.exe -sPAPERSIZE=a4 foo.ps and it works. There may be something wrong with your TeX distribution or GhostScript. I'm not sure. –  Leo Liu Jun 4 '11 at 17:02
1  
@xport: under Windows, you usually have to replace the = sign by a # e.g. ps2pdf -sPAPERSIZE#a4 filename.ps –  Philippe Goutet Jun 4 '11 at 17:37
    
@xport: No. It's only a bit complex. –  Leo Liu Jun 5 '11 at 2:52
    
@xport: try also with ps2pdf -sPAPERSIZE#a4 filename.ps filename.pdf. Do you still have the Unknown paper size: (). error? What error do you have when you just use ps2pdf filename.ps filename.pdf? Have you updated you MikTeX recently? (If it's a bug, it might be fixed.) –  Philippe Goutet Jun 5 '11 at 10:00
    
@xport: glad it worked. ps2pdf under Windows is really touchy about syntax. –  Philippe Goutet Jun 5 '11 at 17:21
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.