简体   繁体   English

使用Powershell自动打印pdf文件

[英]print automatically pdf file with powershell

I'm printing a pdf file with: 我正在使用以下方式打印pdf文件:

Start-Process -FilePath "C:\file.pdf" –Verb Print 

This opens an empty adobe reader window, prints the file, but keeps the adobe reader open. 这将打开一个空的Adobe Reader阅读器窗口,打印文件,但保持Adobe Reader打开。 So, how do I close adobe reader? 那么,如何关闭Adobe Reader?

Thank you in advance. 先感谢您。

From here seems like that is how AcroRd32 will work - it will keep the Adobe Reader open and you can only control whether it is minimized when it starts or not. 这里看来,这就是AcroRd32的工作方式-它将使Adobe Reader保持打开状态,并且您只能控制启动时是否将其最小化。

One alternative is to use Foxit Reader as described here- http://www.deltasblog.co.uk/code-snippets/printing-pdf-files-from-command-line-without-adobe-reader/ 一种替代方法是按此处所述使用Foxit Reader- http://www.deltasblog.co.uk/code-snippets/printing-pdf-files-from-command-line-without-adobe-reader/

Or,Hack: 或者,哈克:

Start-Process -FilePath "test.pdf" –Verb Print
sleep 10
kill -name AcroRd32

Updated hack for multiple Adobe readers open: 已打开针对多个Adobe阅读器的更新的hack:

Start-Process -FilePath "test.pdf" –Verb Print -PassThru | %{sleep 10;$_} | kill

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM