Add cups-pdf to hplip extension


Forum: System
Topic: Add cups-pdf to hplip extension
started by: Juanito

Posted by Juanito on Jan. 11 2008,13:33
I'd like to add a pdf-writer to the hplip extension as a cups backend. I believe OO will write pdf files, but this would allow all other dsl apps to make pdf files.

Using this < script > I managed to get the pdf writer to work with hplip but it writes the pdf files to /export/share/pdf or fails because dsl does not recognise the user "guest" that cups/hplip somehow uses and this will not allow the pdf to be written to /home/guest.

Would one of the dsl script gurus mind to modify the script appropriately (i.e. write to /home/dsl/pdf or similar) so I can add it to hplip?

Posted by ^thehatsrule^ on Jan. 11 2008,16:05
I assume you're talking about user guest with USERMODE=on ?
Code Sample
PRTUSER=$2
This means that the user is passed as the 2nd arg... probably by CUPS - so it is probably configured to use the default user guest.  You can probably either change that default (maybe pass -U dsl to lpadmin), or change the above line to "PRTUSER=dsl" or "PRTUSER=`whoami`".... or change the URI path in the lpadmin invocation "lpadmin -p CUPS-PDF -v pdf-writer:/export/share/pdf/ ...."

Posted by curaga on Jan. 11 2008,17:04
Aren't most programs able to do that already? By printing to PS and then using ps2pdf?
Posted by Juanito on Jan. 11 2008,17:53
I guess so, but I was thinking this was a neater way to do it...
Posted by curaga on Jan. 11 2008,18:30
:D
Posted by Juanito on April 08 2008,14:17
Now the new cups extension is out the door, I seem to be making some progress on having a "pdf printer" available in cups using cups-pdf.

The pdf printer is automatically recognised by cups, the test page passes out of cups to cups-pdf, but appears to fail at the final hurdle due to some sort of permissions "issue".

If I examine the cups error_log and cut & paste the gs command from the middle of all the yada-yada to a terminal window, it will convert a ps file to pdf. If I try to paste the output to the cups-pdf spooler it fails:
Code Sample
$ gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/home/dsl/test.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /home/dsl/test.ps

[works OK]

$ gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/var/spool/cups-pdf/dsl/test.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /home/dsl/test.ps
**** Unable to open the initial device, quitting.

$ ls -l /var/spool
drwx--x---    3 root     staff          80 Apr  8 16:28 cups
drwxr-xr-x    5 root     root          120 Apr  8 16:36 cups-pdf

$ ls -l /var/spool/cups-pdf
drwxr-x--x    2 root     staff          60 Apr  8 16:41 SPOOL
drwx------    2 dsl      staff          60 Apr  8 16:36 dsl
drwx------    2 root     root           60 Apr  8 16:31 root

Note that my understanding of the normal process is that the print is spooled as a ps file in /var/spool/cups-pdf/SPOOL and then processed to /var/spool/cups-pdf/{user}/*.pdf

Any ideas?

Posted by Juanito on April 15 2008,09:51
As it turns out the whole problem was the gs/cups-pdf looks for /var/tmp to use for working files whereas dsl uses /tmp - aaaargh :p

I'll add the now working cups-pdf printer to the cups-1.3.5 extension.

Posted by ^thehatsrule^ on April 15 2008,18:06
iirc, earlier versions of DSL had /tmp point to /var/tmp...
but I guess you found a way to specify it
(I was just wondering if it could be useful to add /var/tmp back in)

Posted by Juanito on April 16 2008,03:41
Quote
but I guess you found a way to specify it

- /etc/cups/cups-pdf.conf allows you to set the gs tmp folder

Quote
earlier versions of DSL had /tmp point to /var/tmp

- since dsl uses /tmp, it might be better that /var/tmp -> /tmp?

Posted by ^thehatsrule^ on April 16 2008,07:51
Quote
- since dsl uses /tmp, it might be better that /var/tmp -> /tmp?
Yea, I was thinking on similar lines.  I was thinking it could be used for possible increased compatibility (though I haven't ran into something that specifically calls for /var/tmp), but that's just my thought... apparently it could be for this: < http://www.pathname.com/fhs/2.2/fhs-5.15.html > which would make sense for the default configuration of gs.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.