[cups] Setting up a file printer under CentOS7

Gernot Hassenpflug aikishugyo at gmail.com
Thu Sep 13 00:39:14 PDT 2018


On Thu, Sep 13, 2018 at 4:28 PM, マスターズ・イアン <ian at ncsa.jp> wrote:

> You need to set CUPS to permit writing to file.
>> You need to use lpadmin to create a printer using the "file" protocol.
>> You need to restart CUPS at some point.
>>
>
> OK, after a bit more faffing around and reading
> https://wiki.debian.org/DissectingandDebuggingtheCUPSPrintin
> gSystem#Introduction ,
> this is what I tried:
>
> 1. Stop CUPS (Still trying to work out if & when this is necessary):
> # systemctl stop cups
>    2 .You need to set CUPS to permit writing to file.
> I added "FileDevice Yes" to /etc/cups/cups-files.conf
>
> 3. You need to use lpadmin to create a printer using the "file" protocol.
> So I did:
> #   lpadmin -p <CUPS printer name> -v file:/tmp -E -P /etc/cups/ppd/<CUPS
> printer name>.ppd
>
>
Interesting. I would have thought you need to specify a file, but it seems
it works if you specify a directory like you did, with the filename being
set by CUPS.

4. You need to restart CUPS at some point.
> systemctl start cups
>
> If I look at the PrintToFile queue, I can see:
>
> [root at centos7-001 ~]# lpq -P PrintToFile
> PrintToFile は準備ができています
> ランク  所有者  ジョブ  ファイル                        合計サイズ
> 1st     3496    104     2018-09-13-1558-test.txt        13312 バイ
>
> But even though the above page says to do:
> # lp -d <print_queue> -o raw <printer-ready_file>
> If I do:
> # lp -d <CUPS Linux Printer name> -o raw 2018-09-13-1558-test.txt
> I get the error telling me there is no such file or directory.
>

I would suggest using the path. I presume if you are typing at a terminal,
auto-completion would allow you to determin whether your file can be found
or not, so try with /tmp/2018<TAB> and see if the file auto-completes.
It might also be a permission issue, but since CUPS created the file I
would assume lp / lpr has permissions to handle it.

Cheers,
Gernot Hassenpflug


More information about the cups mailing list