Linux Printer handling of print codes

Posted by wjbtms on 18-Sep-2006 15:43

I am using an output through statement to open print services in a Linux Red Hat Environment. When I send printer control codes, I may get a blank sheet or nothing at all. If I use no control codes, I get a report unformatted. I have tried setting up the laser printer as text only, postscript and raw and get just about the same results.

The output through statement looks like:

output stream rpt through VALUE (lp -d printer ) PAGED PAGE-SIZE 60.

Has anyone solved this issue?

All Replies

Posted by Admin on 19-Sep-2006 02:42

Hi,

Any reason why you used the "output through" instead of "output to"?

Also are you using "put control" to send the control codes?

Maybe that solves it. I don't think setting the printer to postscript, raw or anything else would help (are you doing this in cups?).

Hope this helps.

Marc

Posted by wjbtms on 19-Sep-2006 13:01

Marc:

Thanks for the suggestions. I have discovered the correct solution to my problem. Here are the details in case you may need it at some time.

Using CUPS and Linux is just a bit different than SCO Unix (my primary platform for clients). The difference is that when printing, CUPS needs the Carriage Return and Line Feed for each line of output, while SCO Unix only needs the Line Feed.

The other item I needed to correct was the sending of the control codes at the beginning of the output.

So here is an example that should help others, since I looked everywhere for an answer and could not find one.

The "unix2dos" adds the carriage return/line feed to each line of output where the line feed was provided. I am unaware of any addition to the output through statement which would do the same thing. That result is then piped to the lp command in linux. I am not sure if the "-o raw" is required, but it was in place when I had a successful test.

FIRST THE OUTPUT STATEMENT USING A STREAM OF rpt.

OUTPUT STREAM rpt THROUGH

VALUE("unix2dos |lp -d printer -o raw") PAGED PAGE-SIZE 60.

THEN THE CONTROL CODE PRINTING:

WGCONTROL=CHR(27) + CHR(38) + CHR(108) + "1O".

/* THIS IS TO SET THE PRINTER IN LANSCAPE MODE

THIS STATEMENT WOULD ALSO WORK:

WGCONTROL="~033&l1O"

*/

PUT STREAM rpt CONTROL WGCONTROL.

Posted by Admin on 07-Jan-2009 02:08

hi wil,

i have CentOS environment and encounter same problem as you did.....

the thing is i dont know where to put the your code on my code....

FIRST THE OUTPUT STATEMENT USING A STREAM OF rpt.

/* Is this a Progress declaration? if yes then how?*/

OUTPUT STREAM rpt THROUGH

VALUE("unix2dos |lp -d printer -o raw") PAGED PAGE-SIZE 60.

THEN THE CONTROL CODE PRINTING:

WGCONTROL=CHR(27) + CHR(38) + CHR(108) + "1O".

/* THIS IS TO SET THE PRINTER IN LANSCAPE MODE

THIS STATEMENT WOULD ALSO WORK:

WGCONTROL="~033&l1O"

*/

PUT STREAM rpt CONTROL WGCONTROL.

this is my code in Unix environment:

ON F10 OF myclip

do:

if prn-dest = "" or prn-dest = ? then

do:

message "Send output to printer?"

view-as alert-box question buttons yes-no update q as logi.

if q then unix silent pcprint -noff value(file-name).

return.

end.

end.

can you help me pls...

xyrus

Posted by Thomas Mercer-Hursh on 07-Jan-2009 11:24

This sure seems like the hard way to solve this problem. On Linux as well as SCO, I solve the problem once in setting up named printers with options and then one simply needs to direct output to them with the right options to get any desired combination of page orientation, font size, etc. Doing it your way you need to solve the problem over and over again for every print program.

This thread is closed