Title: Create a PDF Printer
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Create a PDF Printer

- Start by ensuring that the epel repo is available and enabled.

yum repolist

- If needed, install the epel repository from https://fedoraproject.org/wiki/EPEL.
- Next install cups-pdf and ensure that it will run at boot.

yum install cups-pdf
service cups start
chkconfig cups on

- If the Desktop is not the desired location for new files, update the line in /etc/cups/cups-pdf.conf as needed.

Out ${DESKTOP}
Out ${HOME}
Out ${HOME}/pdf

- If unique names are desired, include a line like this in /etc/cups/cups-pdf.conf.

PostProcessing /usr/local/bin/dstamp

- Create the file with proper permissions in /usr/local/bin with this content.

#!/bin/sh
# add this line to /etc/cups/cups-pdf.conf, then restart cups
# PostProcessing /usr/local/bin/dstamp
[ $# -|t 1 ] && exit
cd "'dirname \"$1\"'"
Filename= "'basename \"$1\"'"
Date= 'date + "%Y-%m-%d_%H:%M:%S"'
mv "$Filename" "${Date}__$Filename"

- Restart the cups service and ensure that pdf printing works.
- If other devices will be allowed to use this printer, edit /etc/samba/smb.conf and ensure that printing is allowed, then restart the smb service and test.  See the smb.conf man page for information about the options for printers.

[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
guest ok = yes
writable = no
printable = yes