Virtual PDF Printer with CUPS Back End for Windows Clients without roaming user profile: Difference between revisions

From SambaWiki
No edit summary
No edit summary
Line 44: Line 44:


* Add the following configuration to your smb.conf (adjust the spool path and print command, if necessary):
* Add the following configuration to your smb.conf (adjust the spool path and print command, if necessary):
[PDFprinter]
#[PDFprinter]
comment = Samba Virtual PDF Printer
path = /var/tmp
path = /var/tmp/
printer = Virtual_PDF_Printer_raw
printable = Yes
comment = Virtual PDF Printer raw
lpq command =
printable = yes

lprm command =
[pdf]
print command = /usr/local/bin/Pdfprint.sh -s /var/tmp/%s \
-d /home/%U -o %U -m 600
path = /srv/samba/pdf_output
read only = no
:For a complete list of all usable variables, see the smb.conf manpage ("Variable substitution", "print command")
hide unreadable = yes



* Check out the scripts help for other parameters, that might be useful
* Check out the scripts help for other parameters, that might be useful

Revision as of 10:41, 3 March 2023

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



Setup

  • Install a new printer on CUPS (I consider that there is already a cups-pdf printer dedicated to linux clients with PPD driver for linux, so we will create a second one for windows clients with RAW driver)
  • Add a new printer in the CUPS web interface (Warning : Only cups-pdf v3.0 and later can create multiple pdf printer)
 # Choose "CUPS-PDF (Virtual PDF Printer)"
 # Name : Virtual_PDF_Printer_raw
 # Description : Virtual PDF Printer Raw
 # Location : CUPS
 # Do not select "Share this printer"
 # Brand : "Raw"
 # Model : "Raw queue"
  • Modify the URI of the new pdf printer created
 # systemctl stop cups
 # edit /etc/cups/printers.conf
 # in the section <Printer Virtual_PDF_Printer_raw> change "DeviceURI cups-pdf:/" to "DeviceURI cups-pdf:/raw"
 # systemctl start cups
  • Create a config file for the new pdf printer created
 # in /etc/cups/ make "cp cups-pdf.conf cups-pdf-raw.conf"
 # edit /etc/cups/cups-pdf-raw.conf
 # modify "Out /srv/samba/pdf_output"
 # modify "Label 2"
  • Create directory for pdf output on the print server
# mkdir /srv/samba/pdf_output
# chgrp -R "SAMDOM\Domain Users" /srv/samba/pdf_output/
# chmod -R 775 /srv/samba/pdf_output/
  • Add the following configuration to your smb.conf (adjust the spool path and print command, if necessary):
 #[PDFprinter]
       path = /var/tmp
       printer = Virtual_PDF_Printer_raw
       comment = Virtual PDF Printer raw
       printable = yes

[pdf]

       path = /srv/samba/pdf_output
       read only = no
       hide unreadable = yes


  • Check out the scripts help for other parameters, that might be useful
# /usr/local/bin/Pdfprint.sh -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.

[PDFprinter]
        .....
        print command = /usr/local/bin/Pdfprint.sh ..... -l /var/log/samba/Pdfprint.log