我的打印机不支持双面打印,因此我基于lpr
实用程序用Python编写了一个简单的脚本。它一页一页地延迟打印文档,在此期间,我手动转文件:
from sys import argv
from subprocess import run
assert(len(argv) == 2)
i = 1
try:
while True:
opt = 'page-ranges={}'.format(i)
i += 1
print(run(['lpr', '-o', opt, argv[1]]))
f = input('> Ready to print next page?\n'
'(Press ENTER or CTRL+C to exit) ')
except KeyboardInterrupt:
print()
问题是我不知道最终打印文档的页数,所以我不知道何时应该中断while
循环。在
也许有什么解决方案可以帮助我获得结果页面的数量?在
另外,我用的是macOS Sierra 10.12.2和A4纸张。在
计数pdf
盘点单据
^{pr2}$请参阅以下页面了解更多详细信息 感谢@Josh&;@a_guest
pyPDF - Retrieve page numbers from document
Number of pages of a word document with Python
相关问题 更多 >
编程相关推荐