开发者

print automatically pdf file with powershell

I'm printing a pdf file with:

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

This opens an empty adobe reader window, prints the file, but keeps the adobe reader open. So, how do 开发者_StackOverflow社区I close 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.

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/

Or,Hack:

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

Updated hack for multiple Adobe readers open:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜