我在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。第二个问题是结果文件已损坏。我可以解决这个问题吗?