我搜索了问题的计算器。最近的链接是:
How to set custom page size with Ghostscript
How to convert multiple, different-sized PostScript files to a single PDF?ghostscript或python:如何将不同页面大小的pdf合并为相同页面大小的pdf?
但这解决不了我的问题。
这个问题很简单。
我们如何将多个PDF(不同页面大小)组合成一个组合的pdf,其中包含所有页面大小相同的页面。
实施例:
两个输入概率密度函数为:
hw1.pdf用的尺寸5.43x3.26英寸的单页(从Adobe阅读器中找到)
hw6.pdf用的尺寸5.43x6.51英寸
PDF文件可以在这里找到:
https://github.com/bhishanpdl/Questions
的代码是:
gs -sDEVICE=pdfwrite -r720 -g2347x3909 -dPDFFitPage -o homeworks.pdf hw1.pdf hw6.pdf
问题:第一张pdf是肖像,第二张是横向。
问题:我们怎样才能让两页的人像都能够?
备注:
-r720是像素/英寸。
大小-g2347x3909使用python脚本发现:
wd = int(np.floor(720 * 5.43))
ht = int(np.floor(720 * 3.26))
gsize = '-g' + str(ht) + 'x' + str(wd) + ' '
# this gives: gsize = -g4308x6066
另一种尝试
commands = 'gs -o homeworks.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=674 ' +\
' -dDEVICEHEIGHTPOINTS=912 -dPDFFitPage ' +\
'hw1.pdf hw6.pdf'
subprocess.call(commands, shell=1)
这首先对两个页面的肖像,但他们不具有相同的尺寸。
当我在Adobe Reader中打开输出时,第一页是较小的尺寸,第二页是满的。
一般来说,我们如何才能使所有页面的大小相同?
它完美无缺! –