[cups.general] Printing to a File

Matthew O'Connor matthew at zeut.net
Tue Jun 19 22:55:04 PDT 2007


Kurt Pfeifle wrote:
>> I'm trying to do something that I thought would be very simple, that is,
>> setup a cups printer that will just dump it's output to a file.
>>
>> The reason I'm doing this is that I have a program that prints to a
>> Zebra barcode printer.  However the program isn't working and I want to
>> see exactly what my program is sending to the printer.  I tried to
>> create a RAW local printqueue that points to /tmp/foo or some such
>> thing.  I restarted cups but it doesn't work, nothing ever goes into the
>> file.
> 
> This is not the correct approach, for 2 reasons:
> 
>  (1) printing the job as "raw" would not give you much info. Raw jobs
>      byepass the CUPS filtering queue and end up at their destination
>      completely un-modified

This is what I want, I don't want CUPS to modify the program output at all.

>  (2) the builtin file:/ backend in CUPS is purposefully not supporting
>      raw printing AFAIR (for security reasons).

OK.

> You have to write your own "2file" backend and use that. Try this one (it is purposefully made more explicit than required):
> --------------------- snip -------------------------------------------
> 
> HOWTO use it:
> 
>  (1) Copy to /usr/lib/cups/backend/2file and make it executable
>  (2) Install printer like this:
>      lpadmin -p fileprinter -v 2file:/path/to/file/output.prn -E -P /path/to/PPD.ppd
>  (3) Each job will end up in /path/to/file/output.prn; new jobs will
>      overwrite the previous one.
> 
> Make sure that /path/to/file/ exists and is writeable for whatever user your cupsd runs as....


Thank you very this worked great.  I did have to restart cups after 
creating the /usr/lib/cups/backend/2file file before the lpadmin command 
would succeed.

Got what I want now.

Thanks again.





More information about the cups mailing list