Virtual PDF Printer: Difference between revisions
From SambaWiki
Mmuehlfeld (talk | contribs) m (Updated category name) |
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/) |
||
Line 27: | Line 27: | ||
[PDFprinter] |
[PDFprinter] |
||
comment = Samba Virtual PDF Printer |
comment = Samba Virtual PDF Printer |
||
path = /var/ |
path = /var/tmp/ |
||
printable = Yes |
printable = Yes |
||
lpq command = |
lpq command = |
||
lprm command = |
lprm command = |
||
print command = /usr/local/bin/Pdfprint.sh -s /var/ |
print command = /usr/local/bin/Pdfprint.sh -s /var/tmp/%s \ |
||
-d /home/%U -o %U -m 600 |
-d /home/%U -o %U -m 600 |
||
:For a complete list of all usable variables, see the smb.conf manpage ("Variable substitution", "print command") |
:For a complete list of all usable variables, see the smb.conf manpage ("Variable substitution", "print command") |
Latest revision as of 13:26, 6 October 2021
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.
Requirements
- Samba configured as a Print Server
- ps2pdf (Part of GhostScript, what is shipped typically with every distribution)
- Bash (script is written in Bash)
Setup
- Download the Bash script File:Pdfprint.sh.txt
- Rename the script to „Pdfprint.sh“ and place it in /usr/local/bin/
- Make the script executable
# chmod 755 /usr/local/bin/Pdfprint.sh
- Add the following configuration to your smb.conf (adjust the spool path and print command, if necessary):
[PDFprinter] comment = Samba Virtual PDF Printer path = /var/tmp/ printable = Yes lpq command = lprm command = print command = /usr/local/bin/Pdfprint.sh -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/Pdfprint.sh -h
- Reload Samba
- If you want to use automatic Point'n'Print driver installation, upload a PostScript driver to your Samba server. You can use any PostScript driver, like the HP Universal Print Driver PostScript.
- 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.
[PDFprinter] ..... print command = /usr/local/bin/Pdfprint.sh ..... -l /var/log/samba/Pdfprint.log