3

在 Poppler 中,PDF 文件被渲染为图像,我试图确定合适的缩放比例,以便能够渲染适合全屏的图像。

我有所有参数,但我不知道为什么结果总是错误的。

myDPIx = 96

screenX = 1366px
screenY = 768px

imageX = 720px
imageY = 720px

zoomX = screenX/imageX
zoomY = screenY/imageY

newDPIx = myDPIx * zoomX
newDPIy = myDPIy * zoomY

假设我们有一个render()函数,它将被如下调用:

new_image = render(image, newDPIx, newDPIy)

不幸的是,渲染的图像太大,这意味着我的计算是错误的?

newImageX = 1840 
newImageY = 1045

大约是2.5倍!

PS:如果我在1.4获得合适的缩放比例时设置了缩放比例,但我会尝试将其设置为适用于所有屏幕分辨率。我错过了什么吗?

4

0 回答 0