3

I'm trying to convert a .ps file made with xmgrace (it's a curve of data as you can guess) but when I convert using ImageMagick via the convert command or ps2pdf with the options -format a4 or -sPAPERSIZE=a4 I end up with the same problem.

Actually the image ends up in the top left corner of my .pdf file while almost 3/4 of the page stays blank. I would like to resize it so it takes the whole page.

In the print setup of xmgrace, I used both the A4 format and a custom default I had 2262x1729 pix and both ended up with the same result.

The header of the .ps file is as follow:

%!PS-Adobe-3.0
%%BoundingBox: 0 0 415 543
%%LanguageLevel: 2
%%Creator: Grace-5.1.22
%%CreationDate: Wed Dec  9 13:21:52 2015
%%DocumentData: Clean8Bit
%%Orientation: Landscape
%%Pages: 1

I saw that touching the bounding box limits could be a way but it seems risky and doesn't solve the problem as I'll have to do it with every single file... Our machines runs on RedHat and actually, my supervisor (compiling and using the same machine) has no problem like mine and can't tell me why.

I suspect my terminal settings to be part of the problem but I'm not sure.

EDIT: Thank you KenS for the answer. I actually managed to use gs to solve my problem regarding the output i got but I also found that using .eps outputs from xmgrace and epstopdf (instead of .ps and ps2pdf as my supervisor does) also solves the problem in an other way. .ps outputs from xmgrace are tricky to use due to (in my initial guess) terminal configuration so I guess I won't use them again.

4

1 回答 1

2

您需要指定(对 Ghostscript) -dEPSFitPage 或者您需要让您的输出请求具有媒体大小(您没有说是否有,并且您没有发布大部分程序,所以我无法判断)。

更改 BoundingBox 注释不会有任何用处。PostScript 解释器要么对它们不做任何事情(这是允许的,它们是注释),要么它会使用它们来设置页面大小,但由于你没有更改内容,你最终会遇到同样的问题。

您需要缩放内容(并可能还翻译原点),如果程序请求媒体,那么您仍然可以让 Ghostscript 缩放它,但您需要设置 -dFIXEDMEDIA 和 -dFitPage 选项。(设置 -dFitPage 可能是最简单的,即使文件是 EPS 而不是 PostScript)。

于 2015-12-09T15:24:57.863 回答