Hi David,
Quick question about PHP Folder Watcher. Running PHP on Windows via Xampp. All I need is a watcher to see new .jpg files and send them to a local printer. But some files I need to send to a certain tray of the printer (i.e. Legal or Letter size). If your script doesn't already do that, do you think it's something I can modify? I know ONLY PHP. Also the printer is NOT the default printer and is shared on a network. Is that an issue?
Thanks so much!
Customer
---------------------------------------------
Thanks for your message, PHP Folder Watcher is just a "watcher" to some folders, if you need to print JPG files to a certain tray of the printer, you need to use following product,
https://veryutils.com/pdf-print-command-line
You may login and download the trial version for free.
PHP Folder Watcher can be purchased on this web page,
https://veryutils.com/php-folder-watcher
PDFPrint Command Line is a Windows Command Line application which can be used to print PDF and Image files to a certain tray of the printer (i.e. Legal or Letter size), the network printer is not an issue, you can use PDFPrint Command Line to print PDF and Image files to both local and network printers without any problem.
-listbins : list bins/trays of a printer
-listjobs : list print jobs in printer's queue
-listall : list printers, ports, monitors etc.
-listpapers : list supported papers from a printer.
-chgbin <int> : change bin/tray for printer by number
-papersource <string> : change bin/tray for printer by name
-settraytopclfile <string> : set tray to PCL file directly, only work when '-papersource' used
for example, you may call following command lines from PHP Folder Watcher to print PDF or JPG files to special tray of the printer,
pdfprint.exe -listbins -printer "docPrint"
pdfprint.exe -listpapers -printer "docPrint"
pdfprint.exe -chgbin 15 -printer "docPrint" C:\input.pdf
pdfprint.exe -papersource "auto" -printer "docPrint" C:\input.pdf
pdfprint.exe -papersource "Tray 1" -printer "docPrint" C:\input.pdf
pdfprint.exe -papersource "Manual Feed" -printer "docPrint" C:\input.pdf
pdfprint.exe -papersource "Media Tray" -printer "docPrint" C:\input.pdf
pdfprint.exe -papersource "Tray 3" -settraytopclfile C:\test.pcl
pdfprint.exe -papersource "auto" -printer "docPrint" C:\input.jpg
pdfprint.exe -papersource "Tray 1" -printer "docPrint" C:\input.png
pdfprint.exe -papersource "Tray 2" -printer "docPrint" C:\input.tif
pdfprint.exe -papersource "Tray 3" -printer "docPrint" C:\input.doc
pdfprint.exe -papersource "Tray 4" -printer "docPrint" C:\input.docx
In the PHP Folder Watcher script, you can modify RunExternalEXE() function to call the PDFPrint.exe application, for example,
function PrintFile($strInFile)
{
$strCurrentFolder = dirname(__FILE__);
$strExeFile = $strCurrentFolder . '/pdfprint/pdfprint.exe';
$strCmd = "\"$strExeFile\" -papersource \"Tray 4\" \"$strInFile\"";
MyEcho(__FILE__, __LINE__, '', $strCmd);
$strRawOutput = shell_exec($strCmd);
MyEcho(__FILE__, __LINE__, '', "<pre>$strRawOutput</pre><br>");
return $strRawOutput;
}
function RunExternalEXE($strInFile, $strInRootFolder, $strOutFolder, $strBackupFolder)
{
MyEcho(__FILE__, __LINE__, '', "[RunExternalEXE] $strInFile => $strOutFolder");
PrintFile($strInFile);
}
If you encounter any problem, please feel free to let us know, we are glad to assist you asap.