ps2pdf:保留页面大小 [英] ps2pdf: preserve page size

查看:63
本文介绍了ps2pdf:保留页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 myfile.ps ,其中包含矢量图像.但是当我跑步

I have myfile.ps with a vector image included. But when I run

ps2pdf myfile.ps

输出页面大小似乎是A4:矢量图像太大而被切掉,因此损失了大约1英寸.

it seems that the output page size is A4: the vector image is too large and become cut away, so about one inch is lost.

除了原始矢量图像之外,以下伪标题还打印在输出PDF文件中:

The following pseudo-header is printed in the output PDF file, in addition to the original vector image:

PLOT SIZE:8.02x8.62Inches
Magnification:7354.21X

是否有任何选择或任何方式将PS文件转换为PDF,并保留原始纸张尺寸?

Is there any option or any way to convert the PS file to a PDF preserving the original paper size?

推荐答案

我怀疑您引用的2行是否真的在PS文件中,如引用的那样……不是它们以 注释字符?

I doubt your quoted 2 lines are really inside the PS file as quoted... Aren't they preceeded by % comment characters?

  • 如果在这些字符之前 ,则PS解释器将不起作用,因为它们不是已知的PostScript运算符.

  • If they weren't preceeded by such characters, no PS interpreter would work, because they are no known PostScript operators.

如果这些字符之前是 ,则PS解释器将完全忽略它们,因为...它们仅是注释!:-)

If they are preceeded by such characters, the PS interpreter would simply ignore them, because... they are comments only! :-)

如果要将这个PS文件转换为PDF,最好直接运行Ghostscript( ps2pdf 仅仅是Ghostscript命令周围的薄壳脚本包装器):

If you want to convert this PS file to PDF, it is better to run Ghostscript directly (ps2pdf is only a thin shell script wrapper around a Ghostscript command anyway):

gs -o myfile.pdf     \
   -sDEVICE=pdfwrite \
   -g5775x6207       \
   -dPDFFitPage      \
    myfile.ps

说明:

  1. -g ... 给出中等大小,以 pixels 为单位.
  2. A4页面的尺寸为 595x842pt (PostScript点).
  3. 1英寸与72个PostScript点相同.
  4. 默认情况下,对于PDF输出,Ghostscript在内部默认以每英寸720像素的分辨率进行计算.
  5. 因此,PDF输出 595x842pt == 5950x8420px .
  6. 针对您所涉案件的情况 8.02x8.62英寸≈≈5775x6207px .
  1. -g... gives the medium size in pixels.
  2. An A4 page has a dimension of 595x842pt (PostScript points).
  3. 1 Inch is the same as 72 PostScript points.
  4. Ghostscript internally by default computes with a resolution of 720 pixels per inch when it comes to PDF output.
  5. Hence for PDF output 595x842pt == 5950x8420px.
  6. Hence for your case in question 8.02x8.62Inches ≈≈ 5775x6207px.

这篇关于ps2pdf:保留页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆