PDFlib=>如何设置打印纸的分辨率为300dpi

PDFlib=> how to set the resolution of printing paper to 300dpi

我是 PDFlib 的新手。使用PDFlib 创建时PDF.I 发现页面(纸张)的dpi 是72.and 我想将dpi 设置为300 以供打印使用,但我不知道如何使用PDFlib 来设置。 enter image description here

正如 flomei 已经提到的,PDF 格式本身没有任何分辨率。为了放置内容或指定页面尺寸,PDFlib 使用 PDF 的默认坐标系,它使用 DTP 点作为单位。来自 PDFlib 9.2 教程,第 3.2.1 章。

PDF’s default coordinate system is used within PDFlib. The default coordinate system (or default user space) has the origin in the lower left corner of the page, and uses the DTP point as unit:
1 pt = 1/72 inch = 25.4/72 mm = 0.3528 mm

当你想用不同的单位来定位位置时,你可以缩放坐标系。请查看相同的 PDFlib 教程章节,“使用公制坐标”部分:

p.scale(28.3465, 28.3465);
After this call PDFlib will interpret all coordinates (except for interactive features, see below) in centimeters since 72/2.54 = 28.3465.

当然你可以使用更多的比例值。