在Acrobat Reader中使用Python静默打印PDF

时间:2020-04-14 08:37:29

标签: python python-3.x subprocess acrobat

我在Python中有以下代码,应该以静默方式在Acrobat Reader中打印PDF文件

import subprocess

if __name__ == "__main__":

    printer_name = "Microsoft Print to PDF"
    pdf_file  = r"C:\Users\xralf\Desktop\to_print\file.pdf"
    acrobat = r"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
    cmd = '"{}" /n /h /s /o  /t "{}" "{}"'.format(acrobat, pdf_file, printer_name)
    subprocess.call(cmd, shell=True)

有两个问题。尽管/t /n表示print the file silently,但它会打开Acrobat Reader。第二个问题是结果文件已损坏。我可以解决这个问题吗?

0 个答案:

没有答案