The following information may have errors; It is not permissible to be read by anyone who has ever met a lawyer. Use should also be confined to Engineers with more than 370 course hours of electronic engineering and should only be used for theoretical studies. All content entered becomes and is (C)2007 Transtronics, Inc. the property of Transtronics, Inc. Rest assured that your contributions won't be sold and will be publicly available.
Print to PDF
From Transwiki
[edit] Print to a PDF file via a Debian server
[edit] A step by step How-to that lets you print from a win box to pdf file on a Debian server
After transferring from RedHat to Debian, we found we had a need to print to file. This note assumes you have found out how to configure SAMBA and only is concerned with the extras to set up a print to PDF print server. Our SAMBA setup is set to run workgroups as we don't want to M$ize anything and are moving to a pure Debian/Linux environment.
Make sure all the packages you need are installed. I highly recommend learning to use wajig if you are doing any server work as it has a unified interface that the apt and dpkg commands lack. See my[rpm2apt-dpkg.htm notes on wajig].
[edit] Required Packages
cups-pdf 1.3.1-5 PDF Writer backend for CUPS cupsys 1.1.20final+cv Common UNIX Printing System(tm) - server libcupsimage2 1.1.20final+cv Common UNIX Printing System(tm) - image libs libcupsys2 1.1.20final+cv Common UNIX Printing System(tm) - libs libqtcups2 2.0-4 Qt interface library for CUPS qtcups 2.0-4 Qt front-end for CUPS. samba 3.0.2a-1 a LanManager-like file and printer server fo samba-common 3.0.2a-1 Samba common files used by both the server a samba-doc 3.0.2a-1 Samba documentation kdeprint 3.2.2-1 KDE Print
[edit] Install CUPS virtual PDF printer
The easiest way to create a PDF file printer is to run the KDE print manager (print-mgr). You will see a "Print 2 file (PDF) printer - ignore it. If you know the command line equivalent to the following process please send it to inform@xtronics.com
- Press the add printer button (not the pseudo printer). Then press "next".
- Select other printer type and click "next".
- Select the very bottom "Virtual Printer [PDF printer]" and click "next".
- Click on "RAW printer" and click "next".
- Skip the test for now and click "next" again.
- Skip the Banners for now and click "next" once more.
- Skip the Quotas for now and click "next" yet again.
- On this screen set to allowed users and enter the user name and add for every user of this printer. Then click "next".
- Next christen the printer with a name - I used print2pdf - add a location and description - location could say username/cups-pdf/ . Description might say "Print to file as PDF"
- Click "next" - and then "Finish".
[edit] Configure CUPS - cupsd.conf
In your favorite editor open /etc/cups/cupsd.conf
Find the lines that say :
<Location /printers> Encryption IfRequested Satisfy All Order allow,deny </Location>
Edit them to say:
<Location /printers> ### Changed for cups print 2 pdf file AuthType None Order Deny,Allow Deny From None Allow From 192.168.1.0/24 #Encryption IfRequested #Satisfy All #Order allow,deny </Location>
Note that 192.168.1.0/24 is my local network with a 24 bit [ip-subnetmasks.htm subnet mask]. Save the changes.
[edit] Edit /etc/cups/mime.convs
Near the bottom, find the line that says:
#application/octet-stream application/vnd.cups-raw 0 -
And uncomment it and save
[edit] Edit /etc/cups/mime.types
Near the bottom, find the line that says:
#application/octet-stream
Uncomment it and save.
Now restart cups
wajig restart cupsys
[edit] Edit /etc/samba/smb.conf
In the [global] sections you will need something similar to this:
#===== Global printer params ==== printing = cups printcap name = cups load printers = yes guest account = nobody log file = /var/log/samba/%m.log
The [printer] section should look something like this:
[printers] comment = All Printers directory = /tmp browseable = yes public = yes guest ok = yes guest account = nobody writable = yes printable = yes create mode = 0777
Save the file and restart samba (wajig restart samba).
[edit] M$ windows configuration
I'm assuming you have Samba working already with windows and you have the samba users set etc. On Win2K: open your windows file browser and under networks/entire network/computers near me/your workgroup find your samba server and locate your new printer share (F5 might come in handy). Right click and select "connect. answer OK and select Apple LaserWriter 16/600 PS for the printer type. ( Picking an Apple Color Laserwriter 12/600 prints in color - The color Laserwriter driver has a color/b&w option on the windows side) A test print will return a pdf in the ~/usernam/cups-pdf directory. You might want to provide a shortcut to the directory on the desk top for the end user.
[edit] Gnome
From a reader: I
n Gnome, the tool would be gnome-cups-manager, 1. Right-Click "New Printer"->"+Add" 2. select "Local Printer", and "Use a detected printer", and "PDF Printer" and click "Forward" 3. For Printer Driver choose "Generic" manufacturer with "PostScript Printer" model and click "Apply" 4. restart samba
[edit] Manual text editor method
[edit] edit the /etc/cups/printers.conf file
[edit] insert or append to end of file:
<Printer PostScript-Printer> Info PDF Printer Location tornado:home/cups-pdf/ DeviceURI cups-pdf:/ State Idle Accepting Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 </Printer>
[edit] restart cupsys, restart samba
[edit] Security
The above creates a rather open printer server - if you want to restrict it further, add restrictive lines one at a time in /etc/cups/cupsd.conf and /etc/samba/smb.conf testing at each step until you feel secure or you break it <g>.
[edit] From a Reader
apt-get install cups-pdf apt-get install gs-gpl
- anyone want to explain the trade offs between the different Ghost Script packages?
lpadmin -p prPDF -E -v cups-pdf:/ -m raw -L Sterrebeek -D "PDF printer"
and add the printer diriver as above, restart samba and cups and it works!
[edit] Troubleshooting
If all goes well you will have a document in the users home/username/cups-pdf folder. if not, set the log level in /etc/cups/cupsd.conf to debug and watch /var/log/cups/error_log (tail -f error_log ) . Don't forget samba's testparm command for checking the config syntax and look in samb's logs. Anyone using samba should appreciate this OSS masterpiece (excellent docs, debugging tools etc). Samba along with cups provide key parts to transitioning to OSS/GNU software. Be sure to visit http://www.debian.org/donations and do your part to continue this historic movement.
[edit] Future
I really would like to set up a print to html, but sadly lack the time to do it - some one else may want to pick up this excelent idea and send the incantation back this way. HTML is not only open but editable!.
As always, please point out any errors, typos, or additional information to the address below.
