1.install cups-pdf printer
1)Download the cups-pdf Package
search for the cups-pdf package for your version of openSUSE.
Next to the first result, click "1-Click Install" and follow the steps to install the cups-pdf package.
2)Set cups-pdf File Permission
Since version 1.2, cups don't support option "RunAsOption" anymore but cups-pdf needs root privileges in order to modify file ownerships.
sudo chmod +s /usr/lib/cups/backend/cups-pdf
3)Install the Printer
(1).Open the CUPS Administration page using a web browser like Firefox (visit http://localhost:631/admin, note: the CUPS service must be running, see System Services (runlevel).)
(2). Select the Administration tab and click Find New Printers
(3). You should see Virtual PDF Printer (CUPS-PDF), click Add This Printer
(4). Click Continue
(5). In the next screen MAKE/MANUFACTURER FOR CUPS-PDF, don't select a printer but in the OR Provide a PPD File section, provide the name of the driver by browsing to /usr/share/cups/model/CUPS-PDF.ppd then click Add Printer.
(6). Use the "root" username and password (or any username with CUPS admin rights) when prompted finish adding the new printer.
4)Configuration Options
PDF Output Location, the default location for the PDF files is
/var/spool/cups-pdf/yourusername/
To change this, edit the /etc/cups/cups-pdf.conf file.
In this case, to the Desktop of the user.
Out ${HOME}/Desktop
2.Print pdf from command line ( Shell file )
#!/bin/csh
set printer=cups-pdf
if( $1 != "" ) then
lpr -P$printer $1
echo ${1} sent to $printer ... OK!
else
echo PDF Print: No filename defined!
endif
save shell script above to pdfprint.bash and make it executable by
chmod +x pdfprint.bash
use pdfprint.bash filename to print.PDF files are output to you desktop.
3.Supplement
At first I meant to use kprinter to print to file(PDF) function.
You can use kprinter at command line.
example:
kprinter --nodialog -d printername filename
more help can be found by using:
kprinter --help
But I can't find the right printername for "print to file (PDF)" option in the kprinter dialog . :-(
It is said that the printer name is the name that appears in the print dialog. If you want to print to PDF, then it's "Print to File (PDF)", there's no easy shortcut.
But it still doesn't work. The error message says that "not found specified or default printer".
-