Therefore, I developed a set of files in order to create a new printer called "pdf-optima" that will create 2 PDF files with different file sizes and quality.Unlike PDFCreator, CUPS-PDF produces very large PDF files and has no dialog in order to choose the PDF file name and directory.
Tested on Mint 17, this is a generic method that should work on many Linux distributions (at least Ubuntu, Debian, ...)
The printer driver is a shell script that dumps the print output in a postscript file, then runs ps2pdf to create 2 pdf files with "screen" and "prepress" quality.
One the PDF files are generated, a C binary program (owned by root with suid privileges) launches a post-processing python script with the privileges of the current logged user.
This python script launches a file chooser dialog in order to save the PDF files in the location and name given by the user and moves the PDF accordingly.
Sorry for the french comments that may be still stuffed in source files
Unzip the attached files in a temporary directory, then open a terminal and execute the following commands :
Code: Select all
sudo -i
(type your password)
cp /your/temp/dir/pdf-optima* /usr/lib/cups/backend/
cd /usr/lib/cups/backend
gcc pdf-optima-post.c -o pdf-optima-post
chmod 4755 pdf-optima-post
chmod a+x pdf-optima pdf-optima-post.py
Code: Select all
<Printer pdf-optima>
Info pdf-optima
DeviceURI pdf-optima
PPDTimeStamp *
State Idle
Type 4
Accepting Yes
Shared Yes
ColorManaged Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>
Code: Select all
sudo gedit /etc/cups/printers.conf
Code: Select all
sudo /etc/init.d/cups stop
sudo /etc/init.d/cups start
Do not hesitate to edit the pdf-optima shell script and pdf-optima-post.py if you want to change the french dialog title and get only one PDF quality.
Credits :
http://osdir.com/ml/printing.cups.devel ... 00007.html
http://forums.gentoo.org/viewtopic-p-5841020.html