cmd or lpr

Post Reply
sherczog
Newbie
Posts: 6
Joined: Wed Mar 23, 2011 3:43 pm

cmd or lpr

Post by sherczog »

Hi,



I am trying to send a postscript through lpr to a postscript printer. If I use a *.cmd file PowerSwitch logs : “postscript was discarded” and nothing is transported to the printer.

the commandline in the file is :





echo off

lpr -S 10.31.157.121 -P print %1




Can anyone tell me what I am doing wrong, or what a alternative method could be.



thanx


rzacherl
Member
Posts: 36
Joined: Mon Mar 21, 2011 3:29 pm

cmd or lpr

Post by rzacherl »

Hi,



three things come to my mind:



- option -S is only supported on Windows

- %1 (the input path) must be surrounded by double quotes since Switch 09

- the permissions of the incoming folder of Execute command must have full read permissions for lpr



Regards



Robert
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

cmd or lpr

Post by dkelly »

Assuming you are using Windows, the lpr command sends a reset prologue before the job. You have to use the '-o' option to prevent this behavior.



lpr -S myserver -P myprinter -o "%1"




Or you can copy the directly to the printer using its UNC name.



copy "%1" "myservermyprinter


Dwight Kelly

Apago, Inc.

dkelly@apago.com
rzacherl
Member
Posts: 36
Joined: Mon Mar 21, 2011 3:29 pm

cmd or lpr

Post by rzacherl »

Using lpr has the big advantageof being able to make use of device specific control parameters via the lpr -o parameter. Examples are (depends on the device capabilities):



-o landscape

-o media=Upper

-o media=Lower

-o media=Tray1

-o media=A4

-o media=two-sided-short-edge

-o sides=one-sided

...



regards,



Robert
sherczog
Newbie
Posts: 6
Joined: Wed Mar 23, 2011 3:43 pm

cmd or lpr

Post by sherczog »

Hi rzacherl and dkelly,



thanx for your effort and reply. I will test it.
sherczog
Newbie
Posts: 6
Joined: Wed Mar 23, 2011 3:43 pm

cmd or lpr

Post by sherczog »

Hi rzacherl and dkelly,



It took some time to figure out, but it works!



the correct argumentfor the command is:

‘E:Testin’ “%1”


and the command for the lpr is :

lpr -S 10.31.157.122 -P print -o "%1"


It would be nice if Enfocus put some examples in their reference guide...anyway, thanx again!



regards
sascha.koerber
Newbie
Posts: 10
Joined: Mon Mar 19, 2012 6:34 pm

cmd or lpr

Post by sascha.koerber »

Hello there,



perfect post that helped me a lot. Thank you!



If you're looking for another challenge, please help me solving the following problem with printing from switch:



Printing via Windows lpr-command works pretty well like described in the posts above - as long as you don`t need to send special commands to the printer. The Windows lpr-command does not provide the -o option in the way the linux lpr does, so you can`t pass on a command to choose a desired output tray.



In Linux i would use something like this:

lpr -P printer -o=">setpagedevice" [filename]



OK - here comes the challenge:



The printer that i`m printing to has a mailbox/sorter unit with output trays. Different flows on the same Switch need to output the prints to different output trays. Neither Windows lpr nor copying the print job to the windows print queue (printerqueue) let me manage, which tray the printer should use.



Do you have any idea/workaround how to solve that, besides creating a print queue for every single output tray?
Post Reply