PDF - lpadmin
Seema
seema.bhatia at flukenetworks.com
Tue Jul 12 13:48:50 PDT 2011
> Seema wrote:
>
> > Installed - cups, poppler and ghostscript from timesys, working on arm
> > processor.
> >
> > I want to create pdf files from QT Application.
> > I am using simple program
> > QPainter painter;
> > QString file = "/home/test/test.pdf";
> > printer.setOutputFormat(QPrinter::PDFFormat);
> > printer.setOutputFileName(file);
> > if(painter.begin(&printer))
> > {
> > QPoint point;
> > point.setX(10);
> > point.setY(10);
> > QString text = "testing";
> > painter.drawText(point, text);
> > painter.end();
> >
> > }
> >
> > Used lpadmin to add printer
> > lpadmin -p "ghostpdf" -v "ipp://localhost:631/home/test" -D "ghostpdf" -E
> > -P "/usr/share/cups/model/ghostpdf.ppd"
> >
> > I have no physical printer attached. What is wrong here?
> >
> > Here is the output of my error_log
> >
> > I [12/Jul/2011:10:58:30 +0000] Listening to ::1:631 (IPv6)
> > I [12/Jul/2011:10:58:30 +0000] Listening to 127.0.0.1:631 (IPv4)
> > I [12/Jul/2011:10:58:30 +0000] Listening to /var/run/cups/cups.sock
> > (Domain) I [12/Jul/2011:10:58:30 +0000] Remote access is disabled.
> > I [12/Jul/2011:10:58:30 +0000] Loaded configuration file
> > "/etc/cups/cupsd.conf" D [12/Jul/2011:10:58:30 +0000] Repairing ownership
> > of "/var/cache/cups" D [12/Jul/2011:10:58:30 +0000] Repairing access
> > permissions of "/var/cache/cups" D [12/Jul/2011:10:58:30 +0000] Repairing
> > ownership of "/var/cache/cups/rss" D [12/Jul/2011:10:58:30 +0000]
> > Repairing access permissions of "/var/cache/cups/rss" D
> > [12/Jul/2011:10:58:30 +0000] Repairing ownership of "/var/run/cups" D
> > [12/Jul/2011:10:58:30 +0000] Repairing access permissions of
> > "/var/run/cups" D [12/Jul/2011:10:58:30 +0000] Creating missing directory
> > "/var/run/cups/certs" D [12/Jul/2011:10:58:30 +0000] Repairing ownership
> > of "/var/run/cups/certs" D [12/Jul/2011:10:58:30 +0000] Repairing access
> > permissions of "/var/run/cups/certs" I [12/Jul/2011:10:58:30 +0000] Using
> > default TempDir of /home/test/tmp... I [12/Jul/2011:10:58:30 +0000]
> > Configured for up to 100 clients. I [12/Jul/2011:10:58:30 +0000] Allowing
> > up to 100 client connections per host. I [12/Jul/2011:10:58:30 +0000]
> > Using policy "default" as the default! I [12/Jul/2011:10:58:30 +0000] Full
> > reload is required. I [12/Jul/2011:10:58:30 +0000] Loaded MIME database
> > from "/usr/share/cups/mime" and "/etc/c. D [12/Jul/2011:10:58:30 +0000]
> > Loading printer ghostpdf... D [12/Jul/2011:10:58:30 +0000]
> > cupsdMarkDirty(P-----) D [12/Jul/2011:10:58:30 +0000] cupsdSetBusyState:
> > Dirty files D [12/Jul/2011:10:58:30 +0000] load_ppd: Loading
> > /etc/cups/ppd/ghostpdf.ppd... D [12/Jul/2011:10:58:30 +0000] load_ppd:
> > Saving /var/cache/cups/ghostpdf.ipp... D [12/Jul/2011:10:58:30 +0000]
> > cupsdMarkDirty(P-----) E [12/Jul/2011:10:58:30 +0000] Filter
> > "/usr/lib/cups/filter/commandtops" for printer "ghost) D
> > [12/Jul/2011:10:58:30 +0000] cupsdRegisterPrinter(p=0x2a06c020(ghostpdf))
> > D [12/Jul/2011:10:58:30 +0000] Scanning /home/storage/Reports for jobs...
> > I [12/Jul/2011:10:58:30 +0000] Full reload complete. I
> > [12/Jul/2011:10:58:30 +0000] Cleaning out old temporary files in
> > "/home/storage/Reports/t. E [12/Jul/2011:10:58:30 +0000] Unable to open
> > listen socket for address ::1:631 - Address f. I [12/Jul/2011:10:58:30
> > +0000] Listening to 127.0.0.1:631 on fd 4... I [12/Jul/2011:10:58:30
> > +0000] Listening to /var/run/cups/cups.sock on fd 6... I
> > [12/Jul/2011:10:58:30 +0000] Resuming new connection processing... D
> > [12/Jul/2011:10:58:30 +0000] cupsdRegisterPrinter(p=0x2a06c020(ghostpdf))
> > D [12/Jul/2011:10:58:30 +0000] Discarding unused server-started event... D
> > [12/Jul/2011:10:58:31 +0000] Report: clients=0 D [12/Jul/2011:10:58:31
> > +0000] Report: jobs=0 D [12/Jul/2011:10:58:31 +0000] Report: jobs-active=0
> > D [12/Jul/2011:10:58:31 +0000] Report: printers=1 D [12/Jul/2011:10:58:31
> > +0000] Report: printers-implicit=0 D [12/Jul/2011:10:58:31 +0000] Report:
> > stringpool-string-count=290 D [12/Jul/2011:10:58:31 +0000] Report:
> > stringpool-alloc-bytes=7320 D [12/Jul/2011:10:58:31 +0000] Report:
> > stringpool-total-bytes=6760 I [12/Jul/2011:10:59:01 +0000] Saving
> > printers.conf... D [12/Jul/2011:10:59:01 +0000] cupsdSetBusyState: Not
> > busy D [12/Jul/2011:11:01:06 +0000] cupsdAcceptClient: 10 from localhost
> > (Domain) D [12/Jul/2011:11:01:06 +0000] Report: clients=1 D
> > [12/Jul/2011:11:01:06 +0000] Report: jobs=0 D [12/Jul/2011:11:01:06 +0000]
> > Report: jobs-active=0 D [12/Jul/2011:11:01:06 +0000] Report: printers=1
> > D [12/Jul/2011:11:01:06 +0000] Report: printers-implicit=0
> > D [12/Jul/2011:11:01:06 +0000] Report: stringpool-string-count=290
> > D [12/Jul/2011:11:01:06 +0000] Report: stringpool-alloc-bytes=7320
> > D [12/Jul/2011:11:01:06 +0000] Report: stringpool-total-bytes=6760
> > D [12/Jul/2011:11:01:06 +0000] cupsdReadClient: 10 POST / HTTP/1.1
> > D [12/Jul/2011:11:01:06 +0000] cupsdSetBusyState: Active clients
> > D [12/Jul/2011:11:01:06 +0000] cupsdAuthorize: No authentication data
> > provided. D [12/Jul/2011:11:01:06 +0000] cupsdReadClient: 10 1.1
> > CUPS-Get-Printers 1 D [12/Jul/2011:11:01:06 +0000] CUPS-Get-Printers
> > D [12/Jul/2011:11:01:06 +0000] Returning IPP successful-ok for
> > CUPS-Get-Printers (no URI) ft D [12/Jul/2011:11:01:06 +0000]
> > cupsdSetBusyState: Not busy D [12/Jul/2011:11:01:06 +0000]
> > cupsdReadClient: 10 POST / HTTP/1.1 D [12/Jul/2011:11:01:06 +0000]
> > cupsdSetBusyState: Active clients D [12/Jul/2011:11:01:06 +0000]
> > cupsdAuthorize: No authentication data provided. D [12/Jul/2011:11:01:06
> > +0000] cupsdReadClient: 10 1.1 CUPS-Get-Default 1 D [12/Jul/2011:11:01:06
> > +0000] CUPS-Get-Default D [12/Jul/2011:11:01:06 +0000] Returning IPP
> > successful-ok for CUPS-Get-Default (no URI) frt D [12/Jul/2011:11:01:06
> > +0000] cupsdSetBusyState: Not busy D [12/Jul/2011:11:01:07 +0000]
> > cupsdReadClient: 10 WAITING Closing on EOF D [12/Jul/2011:11:01:07 +0000]
> > cupsdCloseClient: 10 D [12/Jul/2011:11:03:33 +0000] cupsdAcceptClient: 10
> > from localhost (Domain) D [12/Jul/2011:11:03:33 +0000] Report: clients=1
> > D [12/Jul/2011:11:03:33 +0000] Report: jobs=0
> > D [12/Jul/2011:11:03:33 +0000] Report: jobs-active=0
> > D [12/Jul/2011:11:03:33 +0000] Report: printers=1
> > D [12/Jul/2011:11:03:33 +0000] Report: printers-implicit=0
> > D [12/Jul/2011:11:03:33 +0000] Report: stringpool-string-count=290
> > D [12/Jul/2011:11:03:33 +0000] Report: stringpool-alloc-bytes=7320
> > D [12/Jul/2011:11:03:33 +0000] Report: stringpool-total-bytes=6760
> > D [12/Jul/2011:11:03:33 +0000] cupsdReadClient: 10 POST / HTTP/1.1
> > D [12/Jul/2011:11:03:33 +0000] cupsdSetBusyState: Active clients
> > D [12/Jul/2011:11:03:33 +0000] cupsdAuthorize: No authentication data
> > provided. D [12/Jul/2011:11:03:33 +0000] cupsdReadClient: 10 1.1
> > CUPS-Get-Printers 1 D [12/Jul/2011:11:03:33 +0000] CUPS-Get-Printers
> > D [12/Jul/2011:11:03:33 +0000] Returning IPP successful-ok for
> > CUPS-Get-Printers (no URI) ft D [12/Jul/2011:11:03:33 +0000]
> > cupsdSetBusyState: Not busy D [12/Jul/2011:11:03:33 +0000]
> > cupsdReadClient: 10 POST / HTTP/1.1 D [12/Jul/2011:11:03:33 +0000]
> > cupsdSetBusyState: Active clients D [12/Jul/2011:11:03:33 +0000]
> > cupsdAuthorize: No authentication data provided. D [12/Jul/2011:11:03:33
> > +0000] cupsdReadClient: 10 1.1 CUPS-Get-Default 1 D [12/Jul/2011:11:03:33
> > +0000] CUPS-Get-Default D [12/Jul/2011:11:03:33 +0000] Returning IPP
> > successful-ok for CUPS-Get-Default (no URI) frt D [12/Jul/2011:11:03:33
> > +0000] cupsdSetBusyState: Not busy D [12/Jul/2011:11:03:34 +0000]
> > cupsdReadClient: 10 WAITING Closing on EOF D [12/Jul/2011:11:03:34 +0000]
> > cupsdCloseClient: 10 D [12/Jul/2011:11:04:32 +0000] cupsdAcceptClient: 10
> > from localhost (Domain) D [12/Jul/2011:11:04:32 +0000] cupsdReadClient: 10
> > POST / HTTP/1.1 D [12/Jul/2011:11:04:32 +0000] cupsdSetBusyState: Active
> > clients D [12/Jul/2011:11:04:32 +0000] cupsdAuthorize: No authentication
> > data provided. D [12/Jul/2011:11:04:32 +0000] cupsdReadClient: 10 1.1
> > Get-Jobs 1 D [12/Jul/2011:11:04:32 +0000] Get-Jobs ipp://localhost/
> > D [12/Jul/2011:11:04:32 +0000] Returning IPP successful-ok for Get-Jobs
> > (ipp://localhost/) t D [12/Jul/2011:11:04:32 +0000] cupsdSetBusyState: Not
> > busy D [12/Jul/2011:11:04:32 +0000] cupsdReadClient: 10 WAITING Closing on
> > EOF D [12/Jul/2011:11:04:32 +0000] cupsdCloseClient: 10
> > D [12/Jul/2011:11:04:33 +0000] Report: clients=0
> > D [12/Jul/2011:11:04:33 +0000] Report: jobs=0
> > D [12/Jul/2011:11:04:33 +0000] Report: jobs-active=0
> > D [12/Jul/2011:11:04:33 +0000] Report: printers=1
> > D [12/Jul/2011:11:04:33 +0000] Report: printers-implicit=0
> > D [12/Jul/2011:11:04:33 +0000] Report: stringpool-string-count=290
> > D [12/Jul/2011:11:04:33 +0000] Report: stringpool-alloc-bytes=7320
> > D [12/Jul/2011:11:04:33 +0000] Report: stringpool-total-bytes=6760
> > D [12/Jul/2011:11:04:35 +0000] cupsdAcceptClient: 10 from localhost
> > (Domain) D [12/Jul/2011:11:04:35 +0000] cupsdReadClient: 10 POST /
> > HTTP/1.1 D [12/Jul/2011:11:04:35 +0000] cupsdSetBusyState: Active clients
> > D [12/Jul/2011:11:04:35 +0000] cupsdAu
>
> I guess you want to "print" into PDF files. So you need a backend that
> generates PDF from PostScript and writes it to a (preferably user
> selectable) file.
> Such backends are not part of standard CUPS, but there are a lot of open
> source backends for this purpose around in the internet.
>
> Helge
>
Thank you Helge,
I tried this backend from internet -
and now I think I am missing gs. I could not find gs in installation of ghostscript from timesys package.
I got this error - ps2pdf one one.pdf
/usr/bin/ps2pdfwr: exec: line 45: gs: not found
#!/bin/sh
#################################################################################
#
# File: pdf-writer
#
# Description: A simple PDF Writer for CUPS
#
# Copyright: (c) 2006 Axel Schmidt, SUSE LINUX GmbH, Nuernberg, Germany
# (c) 2001 Michael Goffioul (kdeprint <at> swing <dot> be)
#
# License: GPL
#
#################################################################################
PS2PDF=`which ps2pdf`
DATE=`date +%Y-%m-%d-%H:%M.%S`
# USERMODE="on" changes PDFPATH to "$HOME/<user-name>/PDF"
#
USERMODE="off"
DEFGROUP="users"
HOME="/home"
JOB=$1
PRTUSER=$2
# Create user based file name
#
create_user_fname()
{
if [ "$PRTUSER" != "" ]; then
FILENAME="$PDFPATH/$PRTUSER-$DATE.pdf"
logger "pdf-writer: \"$PRTUSER-$DATE.pdf\" was placed in: $PDFPATH"
else
FILENAME="$PDFPATH/$DATE.pdf"
logger "pdf-writer: \"$DATE.pdf\" was placed in: $PDFPATH"
fi
}
# Check DEVICE DISCOVERY + test PS2PDF
#
if [ "$JOB" = "" ]; then
if test -f "$PS2PDF" ; then
echo "network pdf-writer:/export/share/pdf \"unkown\" \"pdf writer\" "
logger "pdf-writer: INFO: USERMODE=\"$USERMODE\""
if [ "$USERMODE" = "on" ]; then
logger "pdf-writer: CUPS user must be set to root with USERMODE=\"on\"!"
fi
exit 0
else
echo "Error: $0 - ps2pdf is not available!"
logger "pdf-writer: ERROR: ps2pdf is not available!"
exit 1
fi
fi
logger "pdf-writer started: $1 $2 $3 $4 $5 $6"
# Check number of command line arguments
#
if [ $# -ne 5 -a $# -ne 6 ]; then
echo "Usage: $0 job-id user title copies options [file]"
logger "pdf-writer: CRITICAL: Printer stopped !"
exit 1
fi
# get PDF-WRITER directory from device URI
#
PDFPATH=${DEVICE_URI#pdf-writer:}
# Create output filename based on user name and user mode
#
if [ "$USERMODE" = "on" -a "$PRTUSER" != "" ]; then
mkdir -p $HOME/$PRTUSER/PDF
chown $PRTUSER $HOME/$PRTUSER/PDF
# check if cups run as lp or root
# user lp may not run chown
#
if [ $? -eq 1 ]; then
#!/bin/sh
#################################################################################
#
# File: pdf-writer
#
# Description: A simple PDF Writer for CUPS
#
# Copyright: (c) 2006 Axel Schmidt, SUSE LINUX GmbH, Nuernberg, Germany
# (c) 2001 Michael Goffioul (kdeprint <at> swing <dot> be)
#
# License: GPL
#
#################################################################################
PS2PDF=`which ps2pdf`
DATE=`date +%Y-%m-%d-%H:%M.%S`
# USERMODE="on" changes PDFPATH to "$HOME/<user-name>/PDF"
#
USERMODE="off"
DEFGROUP="users"
HOME="/home"
JOB=$1
PRTUSER=$2
# Create user based file name
#
create_user_fname()
{
if [ "$PRTUSER" != "" ]; then
FILENAME="$PDFPATH/$PRTUSER-$DATE.pdf"
logger "pdf-writer: \"$PRTUSER-$DATE.pdf\" was placed in: $PDFPATH"
else
FILENAME="$PDFPATH/$DATE.pdf"
logger "pdf-writer: \"$DATE.pdf\" was placed in: $PDFPATH"
fi
}
# Check DEVICE DISCOVERY + test PS2PDF
#
if [ "$JOB" = "" ]; then
if test -f "$PS2PDF" ; then
echo "network pdf-writer:/export/share/pdf \"unkown\" \"pdf writer\" "
logger "pdf-writer: INFO: USERMODE=\"$USERMODE\""
if [ "$USERMODE" = "on" ]; then
logger "pdf-writer: CUPS user must be set to root with USERMODE=\"on\"!"
fi
exit 0
else
echo "Error: $0 - ps2pdf is not available!"
logger "pdf-writer: ERROR: ps2pdf is not available!"
exit 1
fi
fi
logger "pdf-writer started: $1 $2 $3 $4 $5 $6"
# Check number of command line arguments
#
if [ $# -ne 5 -a $# -ne 6 ]; then
echo "Usage: $0 job-id user title copies options [file]"
logger "pdf-writer: CRITICAL: Printer stopped !"
exit 1
fi
# get PDF-WRITER directory from device URI
#
PDFPATH=${DEVICE_URI#pdf-writer:}
# Create output filename based on user name and user mode
#
if [ "$USERMODE" = "on" -a "$PRTUSER" != "" ]; then
mkdir -p $HOME/$PRTUSER/PDF
chown $PRTUSER $HOME/$PRTUSER/PDF
# check if cups run as lp or root
# user lp may not run chown
#
if [ $? -eq 1 ]; then
create_user_fname
else
chgrp $DEFGROUP /home/$PRTUSER/PDF
PDFPATH=$HOME/$PRTUSER/PDF
FILENAME="$PDFPATH/$DATE.pdf"
logger "pdf-writer: \"$DATE.pdf\" was placed in: $PDFPATH"
fi
else
create_user_fname
fi
# Check write status
#
if [ ! -d "$PDFPATH" -o ! -w "$PDFPATH" ]; then
logger "pdf-writer: ERROR: directory $PDFPATH not writeable"
exit 1
fi
# Run ps2pdf (ghostscript)
if [ $# -eq 6 ]; then
$PS2PDF $6 $FILENAME >& /dev/null
else
$PS2PDF - $FILENAME >& /dev/null
fi
# Chown + set permissions for the user
# Note: this will no work if CUPS runs as lp
if [ "$PRTUSER" != "" ]; then
chmod 644 $FILENAME
chown $PRTUSER:$DEFGROUP $FILENAME
fi
exit 0
#
######################### CUPS pdf-writer ends here ########################
#
create_user_fname
else
chgrp $DEFGROUP /home/$PRTUSER/PDF
PDFPATH=$HOME/$PRTUSER/PDF
FILENAME="$PDFPATH/$DATE.pdf"
logger "pdf-writer: \"$DATE.pdf\" was placed in: $PDFPATH"
fi
else
create_user_fname
fi
# Check write status
#
if [ ! -d "$PDFPATH" -o ! -w "$PDFPATH" ]; then
logger "pdf-writer: ERROR: directory $PDFPATH not writeable"
exit 1
fi
# Run ps2pdf (ghostscript)
if [ $# -eq 6 ]; then
$PS2PDF $6 $FILENAME >& /dev/null
else
$PS2PDF - $FILENAME >& /dev/null
fi
# Chown + set permissions for the user
# Note: this will no work if CUPS runs as lp
if [ "$PRTUSER" != "" ]; then
chmod 644 $FILENAME
chown $PRTUSER:$DEFGROUP $FILENAME
fi
exit 0
#
######################### CUPS pdf-writer ends here ########################
#
More information about the cups
mailing list