python 修改pdf,如何在python中更改已打开的pdf页面

I have the standard pdf link made to open a file to a specific ppage, but if the file is already open, the page doesn't change, the script just opens the already open file, how can I navigate within an open file? or as a workaround, notice that the file is open, close it, and the reopen it?

path_to_pdf = os.path.abspath(openfile)

path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe')

process = subprocess.Popen([path_to_acrobat, '/A', 'page=' + page, path_to_pdf], shell=False, stdout=subprocess.PIPE)

process.wait()

解决方案

Sometimes it's not polite to kill other processes -- especially if your program is not the one that spawned it. In such a case you may prefer to simply launch another acrobat process. To do that on Windows, use the /n option:

process = subprocess.Popen([path_to_acrobat, '/n', '/A', 'page=' + page, path_to_pdf], shell=False, stdout=subprocess.PIPE)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值