Printing to file with CUPS.

Kurt Pfeifle kpfeifle at danka.de
Fri Aug 11 04:54:21 PDT 2006


Piotr <piotrwie at gmail.erase-me.com> wrote (Friday 11 August 2006 12:36):

>> (in cupsd.conf) and you'll have "print to file" support. Then install
>> your "psfileprinter":
>>
>>    lpadmin -p psfileprinter -v file:/tmp/my-ps-files -E -P /path/to/PPD
>>
>> Create the target directory:
>>
>>    mkdir /tmp/my-ps-files
>>
>> For the PPD you'd need to use one that is meant for a PostScript
>> printer. To avoid inserting too much useless printer-specific code
>> into the file, use a very generic one. (The one from an old version
>> of Adobe Acrobat Distiller is fine).
>>
>> Cheers,
>> Kurt
> 
> (parts of mail <cut>)
> 
> Thanks for this hint. 

It contained a mistake (as indicated in my last mail). Sorry for the
trouble I caused you.

> I already found the cupsd.conf setting that  
> needs to be set (although it's a pity it's not covered by some 
> howto, only you ned to look into the CUPS handbook - however... 
> Good that such a handbook exists :)
> 
> But...
> 
> Problem #1
> I've choosen a "Generic Postscript PPD" file from linuxprinting.org.

It's not a good one for the specific use here. And I didn't advice to 
use it.

Thing is, it calls "foomatic-rip" as its last filter (which is a 
wrapper around Ghostscript). And we do not want the PS that's the
result of this specific filtering path, we want the output of
CUPS' pstops.

> I've created printer with:
> lpadmin -p psfileprinter -v file:/my-ps-files -E -P
> /usr/lib/cups/ppd/Generic-PostScript_Printer-Postscript.ppd After I printed testpage to file, my
> ghostscript interpreter (EPS 8.15) creates following output error message after invoking: gv
> /my-ps-files (not a directory... it's a... file :)

*blush*

I'm sorry for my mistake.

> look problem #2 
> (identic error message is displayed with gs, but it's easier to copy'n'paste)
> ---------------------------------------------------------------------
> root at ciuchcia:/# gs my-ps-files
> ESP Ghostscript 815.00 (2005-08-11)
> Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> Error: /configurationerror in --setpagedevice--
> Additional information: [/ManualFeed false]
> Operand stack:
>    --dict:1/1(L)--
> Execution stack:
>    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_pu  h  
>    --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %opar 
>    ay_pop   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   .runexec2   --nostrin 
>    val--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1   3   %oparray_ 
>    op   --nostringval--   --nostringval--   --nostringval--   --dict:1/2(L)--   --nostringval--   2    
>    dict_continue
> Dictionary stack:
>    --dict:1114/1686(ro)(G)--   --dict:0/20(G)--   --dict:80/200(L)--
> Current allocation mode is local
> Last OS error: 2
> Current file position is 86
> ESP Ghostscript 815.00: Unrecoverable error, exit code 1
> -------------------------------------------------------------------
> 
> The same happended when I used a ppd of apple laserwriter's 16/600 PPD.

That one should be fine too... (once you "mkdir /tmp/my-ps-files", 
your file printers should be working, and print each job to a file 
named "/tmp/my-ps-files" -- where each new job overwrites the old 
output file).

> (i simply created second print-to-file printer with apple's PPD 
> file).  It also happended when I used generic ppd with ghostscript 
> filtering to version 2 of PS with limited resolution (or extended? ;) 
> 1200x1200 dpi) and A4 paper output. 
> 
> Is it possible that there's some incompatibility between 
> ghostscript and  PPDs??? 

Nah, it was the incompatibility of Kurt being up late, and trying to
give similar (but different) advice to different people in a multi-
tasking like way...

[... skipping things you better ask again if they aren't fixed by
     above modifications ...]

> Third thing
> The created ps (although not much readable for me yet - look 
> problem#1) has following file attribs: 
> -rw------ meaning it's only readable by root user.

Just do once as root 

   chmod 777 /tmp/whatever-the-filename-is-you're-using

and the next time the file backend overwrites the file, these
attributes will still survive...

Cheers,
Kurt




More information about the cups mailing list