Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
net-print/cups-pdf Just Won't Work (tm).
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Nightweaver
n00b
n00b


Joined: 24 Jul 2002
Posts: 40

PostPosted: Wed Oct 27, 2004 11:34 pm    Post subject: net-print/cups-pdf Just Won't Work (tm). Reply with quote

Hi, folks. We've recently purchased a brand spanking new laser printer for the home network, giving me a reason to finally get around to installing and configuring cups. I've installed the printer, and finally got it working (albeit not optimally; the printer's really new, so I have to pretend it's a slightly older model), but then decided to also set up a PDF printer - since I could.

I've installed cups-pdf, read through the readme, restarted cups, added the printer using the web interface (using the colour postscript driver), and then restarted again for good measure. Unfortunately, nothing seems to work - whenever I try to print, the "printer" turns itself off (switches to 'stopped') and won't restart until I delete the job from the queue.

I've left pretty much all the cups settings at their default, though I tried temporarily changing user and group to root, as well as specifying the "NoChangeUser" option, or whatever it's called, to No - none of which seemed to work (after restarting cups, of course).

Has anyone got the cups-pdf virtual printer working? If so, can they shed some light on how?

Some snippets of info:

ACCEPT_KEYWORDS=~x86
Installed versions:
net-print/cups-1.1.21-r2
net-print/cups-pdf-1.6.4
app-text/ghostscript-7.07.1-r7

Thanks for any assistance.
Back to top
View user's profile Send private message
nobspangle
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1318
Location: Manchester, UK

PostPosted: Sun Oct 31, 2004 2:50 pm    Post subject: Reply with quote

I updated cups-pdf to 1.52 with emerge -uD world and now it doesn't work, I have also tried the 1.64 version without luck. I've tried reemerging ghostscript but that hasn't helped.
I've had a look at the ebuild but there is nothing to it. cups-pdf is so simple it should just work, and for me it always has done.

Going back to 1.31 fixes my problem I think I'll file a bug
Back to top
View user's profile Send private message
nicdoo
n00b
n00b


Joined: 24 Feb 2004
Posts: 2

PostPosted: Sun Nov 21, 2004 11:59 pm    Post subject: Reply with quote

Hello
I succeeded installing and runing cups-PDF after installing (emerging) several new versions of cups-pdf, cups, samba, ghostscript...

here are the versions I used but the problem is the same with older version :
net-print/cups-1.1.22
net-print/cups-pdf-1.6.4
app-text/ghostscript-7.07.1-r7
net-fs/samba-3.0.7-r1

Trying to print . . .
Allways the same error message in the log (/var/log/cups/cups-pdf_log):
[ERROR] failed to set file mode for PDF file (/var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf)

so I recompiled cups-pdf manually to know more, increasing debug level
here is what is executed :

/bin/su - "nobody" -s /bin/sh -c "/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite sOutputFile=/var/spool/cups-pdf/nobody/Page_de_test.pdf -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c save pop -f /var/spool/cups-pdf/SPOOL/cups2pdf-1078"

Running this command manually just don't work for these reasons :
1 - the "-s" parameter for su is not supported in my gentoo
2 - even if I do without the "-s" parameter nothing works :roll:
3 - executing the gs command only, getting this result :
**** Unable to open the initial device, quitting. 8O
the "pdfwriter" device is not valid on my gentoo . . .

Conclusions :
1 - Whe had very few chances for having a pdf generated
2 - Initial Error message "[ERROR] failed to set file mode for PDF file" that allways focused me on a cups configuration problem, should have been "[ERROR] failed generate the PDF file"

Solution : (not taking care of security issues)

1 - uncompress the ebuild package on your root's home directory
Code:
$ su
Password:
# cd
root# tar -zxf /usr/portage/distfiles/cups-pdf_1.6.4.tar.gz
root# cd ./cups-pdf-1.6.4/src/
src#


2 - modifying the "cups-pdf.h" header file like this :
Replace theses lines :
Code:
#define CPGSCALL "%s - \"%s\" %s -c \"%s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH \
        -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s\" -c save pop -f %s\""

... by this :
Code:
#define CPGSCALL "ps2pdf %s %s"


3 - Now go to edit the file "cups-pdf.c" - line 446 (near the end)
replace this line :
Code:
snprintf(gscall, size, CPGSCALL, CPSU, passwd->pw_name, CPSH, CPGHOSTSCRIPT, CPPDFVER, outfile, spoolfile);


...by these lines :
Code:
/*  snprintf(gscall, size, CPGSCALL, CPSU, passwd->pw_name, CPSH, CPGHOSTSCRIPT, CPPDFVER, outfile, spoolfile); */
  snprintf(gscall, size, CPGSCALL, spoolfile, outfile);


4 - compile the source code like :
Code:
gcc -O9 -s -o cups-pdf cups-pdf.c


5 - replace the file on the cups backend directory :
Code:
cp cups-pdf /usr/lib/cups/backend/


Now your virtual PDF printer sure works :-)

PS : This is only valid in ANONYMOUS mode, for other modes the user will not be able to read the file, that is why the su command was used.
Back to top
View user's profile Send private message
mkrisch
n00b
n00b


Joined: 22 Nov 2004
Posts: 59

PostPosted: Mon Nov 22, 2004 4:33 am    Post subject: Reply with quote

found an easier recompile solution. in cups-pdf.h there's a definition for CPSH and the comment notes that if your distro doesn't support the -s command, set CPSH to "".

with a recompile that seemed to fix the problem.

--mk
Back to top
View user's profile Send private message
wulu
n00b
n00b


Joined: 06 Jan 2003
Posts: 14

PostPosted: Sun Nov 28, 2004 11:16 am    Post subject: Reply with quote

Thanks,

works perfectly :)

just added this line to the ebuild
Code:

--- cups-pdf-1.6.4.ebuild.org   2004-11-28 12:09:29.170844728 +0100
+++ cups-pdf-1.6.4.ebuild       2004-11-28 12:09:58.059452992 +0100
@@ -19,6 +19,7 @@
        cd src
        sed -i -e "s:CPLOGTYPE 7:CPLOGTYPE 2:" \
                   -e "s:nobody:lp:" cups-pdf.h
+       sed -i -e "s:CPSH \"-s /bin/sh\":CPSH \"\":" cups-pdf.h
        gcc ${CFLAGS} -o cups-pdf cups-pdf.c || die "Compilation failed."
 }


<wulu>
Back to top
View user's profile Send private message
Freak_NL
Apprentice
Apprentice


Joined: 27 Jun 2002
Posts: 261
Location: The Netherlands

PostPosted: Sun Nov 28, 2004 4:25 pm    Post subject: Reply with quote

Thanks! :)

I ran into this problem as well, but the modified ebuild fixes it. Has this been submitted to the Gentoo Bugzilla?
Back to top
View user's profile Send private message
Nightweaver
n00b
n00b


Joined: 24 Jul 2002
Posts: 40

PostPosted: Mon Nov 29, 2004 3:18 am    Post subject: Reply with quote

Yeah, it has. Hopefully it'll be integrated soon.
_________________
My mummy says I'm l33t.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum