php打印pdf文件到指定的网络打印机而不打开对话框

I am generating a pdf file using mpdf and then emailing the PDF attachment using PHPMAILER.

I want to also print a copy of the PDF to a specified printer - silently without the print dialog box opening.

I would prefer to do this from PHP, but also dont mind if there is a better solution from javascript.

Please advise best way to do this.

$val = "test1.pdf";
$prAddr1="C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe";
exec(" \"$prAddr1\"  /p $val ");

Pdf will get printed by the printer you specified as your default in Devices and Printers.