在由 ReStructuredText 转换的 pdf 格式中,数字未以原始大小显示
Figures does not appear in original size in pdf format converted by ReStructuredText
我正在使用 ReStructuredText (rst) 格式创建文档。我使用 this 第一个转换器将文档转换为 pdf 格式。当我尝试 link 一个图形时,它不会以 pdf 格式的原始尺寸显示。所有显示的图像都非常小,但我使用相对较大的图像(.png 和 .jpg),例如宽度为 470px,高度为 520px。如果我将图像的宽度和高度乘以三,它就会以所需的大小出现,但我认为这不是解决这个问题的正确方法。我也试图通过互联网寻找解决方案,但我还没有找到任何解决方案。有没有人愿意在这件事上帮助我?提前致谢!
示例代码:
.. figure:: img/device_manager.jpg
:align: center
:alt: Run window
:width: 470px
:height: 520px
:scale: 100
这个问题的描述是in the manual:
Images usually are measured in pixels, which are meaningless in a PDF. To convert
between pixels and inches or centimeters, we use a DPI (dots-per-inch) value.
For example, 300 pixels, with a 300DPI, are exactly one inch. 300 pixels at 100DPI are 3 inches.
For that reason, to achieve a nice layout of the page, it's usually a good idea to specify the size of your images in those units, or as a percentage of the available width and you can ignore all this DPI nonsense ;-)
The rst2pdf default is 300DPI, but you can change it using the --default-dpi
option or the default_dpi
setting in the config file.
因此,只需降低用于生成 PDF 的 DPI。
我正在使用 ReStructuredText (rst) 格式创建文档。我使用 this 第一个转换器将文档转换为 pdf 格式。当我尝试 link 一个图形时,它不会以 pdf 格式的原始尺寸显示。所有显示的图像都非常小,但我使用相对较大的图像(.png 和 .jpg),例如宽度为 470px,高度为 520px。如果我将图像的宽度和高度乘以三,它就会以所需的大小出现,但我认为这不是解决这个问题的正确方法。我也试图通过互联网寻找解决方案,但我还没有找到任何解决方案。有没有人愿意在这件事上帮助我?提前致谢!
示例代码:
.. figure:: img/device_manager.jpg
:align: center
:alt: Run window
:width: 470px
:height: 520px
:scale: 100
这个问题的描述是in the manual:
Images usually are measured in pixels, which are meaningless in a PDF. To convert between pixels and inches or centimeters, we use a DPI (dots-per-inch) value.
For example, 300 pixels, with a 300DPI, are exactly one inch. 300 pixels at 100DPI are 3 inches.
For that reason, to achieve a nice layout of the page, it's usually a good idea to specify the size of your images in those units, or as a percentage of the available width and you can ignore all this DPI nonsense ;-)
The rst2pdf default is 300DPI, but you can change it using the
--default-dpi
option or thedefault_dpi
setting in the config file.
因此,只需降低用于生成 PDF 的 DPI。