如何指定PDF尺寸? [英] How are PDF sizes specified?

查看:126
本文介绍了如何指定PDF尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用库从HTML生成PDF,并且我提供的所有大小参数均以像素为单位.这似乎有点奇怪.我刚刚在互联网上搜索了像素为A4的尺寸,是否可以在所有地方都使用这些值?

I am generating a PDF from HTML using a library, and all the size parameters that I am giving are in pixels. This seems kind of odd. I just googled the internet for A4 size in pixels, and can I just use these values everywhere?

这应该怎么做?生成的PDF看起来正确吗?

Is this how it should be done? Will the generated PDF look correctly?

否则,我是否需要使用屏幕上的信息以某种方式计算像素大小?

Otherwise, do I need to somehow compute the pixel size using information from the screen?

然后,如果PDF可以发送给其他人并且看上去仍然相同,那该如何工作?

Then, how do PDF's work if they can be sent to others and still look comparatively the same?

推荐答案

PDF内部使用与PostScript相同的图形模型. PDF源自PostScript.基本上,...

PDF internally uses the same graphics model as PostScript. PDF is derived from PostScript. Basically,...

  • ...它使用与PostScript中可用的完全相同的运算符,但是将它们从长且完全可读的名称重命名为短的1、2或3个字母的缩写;
  • ...但是,它剥离了使PostScript成为成熟的编程语言的所有功能;
  • ...并且它添加了一些新的图形功能,例如透明度和直接TrueType字体嵌入.

PDF还使用与PostScript相同的基本测量单位: 72个点== 1英寸.您也可以使用分数分数. 这是与设备无关的说明尺寸的方式.

PDF also uses the same basic measurement unit as PostScript: 72 points == 1 inch. You may also use fractions of points. This is the device independent way of stating dimensions.

如果您曾经使用像素,则可以这样做.如果这样做,则显示器或打印纸上图形对象的绝对大小取决于显示器或打印机的当前分辨率. 72px x 72px的正方形在72dpi分辨率下为1英寸x 1英寸,但在720dpi分辨率下为0.1英寸x 0.1英寸. 因此,使用像素是表示尺寸的与设备相关的方式.

If you ever use pixels, you can do so. If you do, the absolute size of a graphic object on the display or the printed paper then depends on the current resolution of the display or printer. A square of 72px x 72px is 1inch x 1inch at a 72dpi resolution, but it is 0.1inch x 0.1inch at a 720dpi resolution. Therefore using pixels is a device dependent way of stating dimensions.

A4尺寸为宽x高= 595 x 842磅" .

这篇关于如何指定PDF尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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