[cups.general] (long) Filter script on raw printer?

Tim Pushor timp at crossthread.com
Tue Nov 23 09:29:44 PST 2004


Hi Tony,

Thanks for the response.

You made some very good points, ones that I hadn't thought of yet. We 
don't really do too much graphics, but some forms do have lines and 
such, but it is also possible that lf characters are embedded in other 
PCL commands.

So I have modified my script to prepend an <esc>&k2G to the print job 
and that seems to work. Now I just have to play with making a PPD.

I was hoping that I wouldn't have to do that, but maybe thats the best 
(most flexible) in the long run.

Thanks again,
Tim

ony Wood wrote:

> I am new to CUPS too.
>
> My suggestion is don't do it!!!
>
> We have many people who insist that the only thing printed to printer 
> "X" is ascii text. These people know that we send PCL to that same 
> printer but because they looked at the PCL they have determined that 
> to be ascii text. PCL is a binary format so those documents that 
> include graphics are constantly corrupted. What you are trying to do 
> then is something similar where ALL output to the printer has any 
> occurrance of LF is converted to CR/LF which is in some situation is 
> incorrect and will corrupt the data being sent.  Be aware of this 
> warning.
>
> One option;
> The CUPS documentation talks about how to write a filter. Read that 
> documentation as it contains everything you need to know. I wrote a 
> filter in perl based on this documentation.
>
> The next step is getting the filter into the data stream to do what 
> you want (heeding the warning above). For that you will need to create 
> PPD file for the printer and include a line in the PPD like
>
> *cupsFilter:    "text/plain 0 NameOfFilter"
>
> Another option;
>
> Create a shell script to submit the job to lp for you and use that 
> rather than lp - call it lpcrlf;
>
> cat - | awk '{printf "%s\r\n", $0}' | lp $@
>
> This works with bash but should with any shell you use.
>
> This is quicker and then means the printer can still be used to print 
> binary files too. The script passes all of the options given to it to 
> the lp command.
>
> Which ever method you choose or pick pieces from it can be made to 
> work because we do something similar here.
>
> Regards,
>
> T.
>
> _______________________________________________
> cups mailing list
> cups at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups






More information about the cups mailing list