Virtual PDF Printer

From SambaWiki
Revision as of 13:26, 6 October 2021 by Mmuehlfeld (talk | contribs) (Changed /var/spool/samba/ to /var/tmp/ . That directory exists on Linux distributions by default. MR 2192 will update the smb.conf man page which then also recommends /var/tmp/)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Beside the various PDF printer programs, which require an installation on clients, it might be useful, to have a virtual Samba printer. This enables users to create and automatically store PDF files on the server, as simple as printing. No additional software installation is required on the clients, if your Samba Print Server provides Point'n'Print support.



  • Rename the script to „“ and place it in /usr/local/bin/
  • Make the script executable
# chmod 755 /usr/local/bin/
  • Add the following configuration to your smb.conf (adjust the spool path and print command, if necessary):
        comment = Samba Virtual PDF Printer
        path = /var/tmp/
        printable = Yes
        lpq command =
        lprm command =
        print command = /usr/local/bin/ -s /var/tmp/%s \
                        -d /home/%U -o %U -m 600
For a complete list of all usable variables, see the smb.conf manpage ("Variable substitution", "print command")
  • Check out the scripts help for other parameters, that might be useful
# /usr/local/bin/ -h
  • Reload Samba
  • If you don't want to use Point'n'Print driver installation, add the following line to the printer configuration:
use client driver = yes

Using the virtual PDF printer

  • Connect the printer on your client.
  • Simply send a print job to the PDFprinter and the PDF is stored in the configured path with the defined permissions.

Solving problems

If the PDF isn't stored in its destination, enable the logging option of the script.

        print command = /usr/local/bin/ ..... -l /var/log/samba/Pdfprint.log