batch-filelpr

How to avoid delays printing LPR using batch file


I was submitting print jobs to a Ricoh copier/printer via LPR and was getting strange delays. Prints 11 print jobs then waits 1 minute 14 seconds. Repeats print and delay cycle until the end.

Why the delay and what can I do to avoid the delay? I want to print fast!

Initially I was using VB.net program with cmd.exe process with StreamWriter handling Process.StandardInput. But the delays got me looking for another idea. So I wrote all the files to a batch file and ran it. Still getting delays!!! Why and how do I fix it???

Replacing {IP Address}}, QueueName and FileName as appropriate:

"C:\Windows\System32\lpr.exe" -S {IP Address} -P QueueName -o l "FileName1.prn"
"C:\Windows\System32\lpr.exe" -S {IP Address} -P QueueName -o l "FileName2.prn"
"C:\Windows\System32\lpr.exe" -S {IP Address} -P QueueName -o l "FileName3.prn"
...

Why the delays and how do I avoid them?


Solution

  • Windows use by default lpr ports 721 to 731, this makes a total of 11 ports, which is why you experience 11 print jobs and then the timeout.

    Instead, use dynamic ports by setting the following registry key's REG_DWORD to 1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\LPDSVC\lpr and restart the print spooler.

    Reference