开发者

Weird problem, with ghostscript and pdf files

am using ghostscript to create pdf file from postscript file. My PS file, doesn't have orientation instructions, so when I want to create landscape pdf file, I'm using ghostscript to rotate the page. The problem is, that ghostscript rotates only the first page, and when my pdf file is more than 1 page, the others, are not rotated correctly. Here is the command I'm using:

cat $psinput | gs -sPAPERSIZE=a4 -sDEVICE=pdfwrite开发者_如何学运维 -sOuputFile="/tmp/pdf" \
        -dAutoRotatePages="/None" -c "<< /Orientation 3 >> setpagedevice" \
        90 rotate 0 -595 translate -dNOPAUSE -dEPSCrop  -f - -c -quit

Does anybody have an idea how to correct this?


Without seeing your actual $psinput it is difficult to give definite advice. Your $psinput, coming via stdin to Ghostscript, could contain multiple PS files... Have you tried playing with one of these options

  • -dOrient1=true
  • -dOrient1=false

in your commandline? Also, it looks to me like you should put your 90 rotate 0 -595 translate command inside the quotes going with -c, and then position the input (-f -) to the very end of processing like so:

  • -c "<</Orientation 3>> setpagedevice 90 rotate 0 -595 translate" -f - -c quit

Also have you tried to use

  • -c ".setpdfwrite <<//AutoRotatePages /PageByPage>> setdistillerparams" or
  • -c ".setpdfwrite <<//AutoRotatePages /All>> setdistillerparams" or
  • -c ".setpdfwrite <<//AutoRotatePages /None>> setdistillerparams"

on your commandline (with or without your original rotating code)?


If you must not use ghostscript to do the rotation, you can probably use pdftk or impose instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜