Reputation: 138
I am trying to print a PDF using powershell and AcroRd32.exe and now run into a problem I can't solve by myself. If I am executing the code and Acrobat Reader opens but no print job is generated. I can even see my pdf in the latest use files.
This is my code:
$file = "C:\temp\file.pdf"
$adobe = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
$driver = "HP Universal Printing PCL 6"
$port = "10.200.1.63:3910"
$printer = "\\pserver\printer07"
$arglist = "/s /t $($file) $($printer) $($driver) $($port)"
Start-Process $adobe -argumentlist $arglist -wait
I tried the following:
Even without driver and port I am not able to print a file through this code.
Does anyone have useful tips or suggestions to solve this problem?
Upvotes: 1
Views: 2322
Reputation: 17074
This might be the cause of your problem or not, but there are spaces in $driver
, so you definitely need to add quotes in the command line (I did it for all variables, just in case):
$arglist = "/s /t `"$file`" `"$printer`" `"$driver`" `"$port`""
Upvotes: 1