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 |
||
(42 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
* CUPS installed |
* CUPS installed |
||
* package cups-pdf installed |
* package cups-pdf installed |
||
Line 17: | Line 15: | ||
= Setup = |
= Setup = |
||
* Install a new printer on CUPS ( |
* Install a new cups-pdf printer on CUPS (We consider that there is already a cups-pdf printer dedicated to linux clients with PPD linux driver, so we will create a second cups-pdf printer with RAW driver for windows clients) |
||
* Add a new printer in the CUPS web interface |
* Add a new printer in the CUPS web interface (Warning: Only cups-pdf v3.0 and later can create multiple pdf printers) |
||
Choose "CUPS-PDF (Virtual PDF Printer)" |
|||
Name : Virtual_PDF_Printer_raw |
|||
Description : Virtual PDF Printer Raw (or something else) |
|||
Location : CUPS (or something else) |
|||
Do not select "Share this printer" |
|||
Brand : "Raw" |
|||
Model : "Raw queue" |
|||
* |
* Change the URI of the new cups-pdf printer created |
||
# systemctl stop cups |
# 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 |
# systemctl start cups |
||
* Create a config file for the new pdf printer created |
* Create a config file for the new cups-pdf printer created |
||
In /etc/cups/ make "cp cups-pdf.conf cups-pdf-raw.conf" |
|||
Edit /etc/cups/cups-pdf-raw.conf |
|||
Change to "Out /srv/samba/pdf_output" |
|||
Uncomment "Label 2" (to avoid pdf files with the same name) |
|||
* Create directory for pdf output on the print server |
* Create directory for pdf output on the print server |
||
Line 40: | Line 41: | ||
# chmod -R 775 /srv/samba/pdf_output/ |
# chmod -R 775 /srv/samba/pdf_output/ |
||
* Add the following configuration to your smb.conf (adjust the spool path |
* Add the following configuration to your smb.conf (adjust the spool path if necessary): |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
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 |
|||
printer = Virtual_PDF_Printer_raw |
|||
⚫ | |||
⚫ | |||
The above section is not necessary if you use "load printers = yes" in your smb.conf |
|||
[pdf] |
|||
path = /srv/samba/pdf_output |
|||
⚫ | |||
hide unreadable = yes |
|||
* Reload Samba |
* Reload Samba |
||
# smbcontrol all reload-config |
|||
* If you want to use automatic Point'n'Print driver installation, [[Setting_up_Samba_as_a_Print_Server#Uploading_printer_drivers_for_Point.27n.27Print_driver_installation|upload a PostScript driver to your Samba server]]. You can use any PostScript driver, like the [http://www.hp.com/go/upd HP Universal Print Driver PostScript]. |
* If you want to use automatic Point'n'Print driver installation, [[Setting_up_Samba_as_a_Print_Server#Uploading_printer_drivers_for_Point.27n.27Print_driver_installation|upload a PostScript driver to your Samba server]]. You can use any PostScript driver, like the [http://www.hp.com/go/upd HP Universal Print Driver PostScript]. |
||
Line 62: | Line 65: | ||
* [[Setting_up_Samba_as_a_Print_Server#Associating_a_shared_printer_with_a_driver_and_preconfiguring|Associate the PDFprinter with the uploaded driver]] |
* [[Setting_up_Samba_as_a_Print_Server#Associating_a_shared_printer_with_a_driver_and_preconfiguring|Associate the PDFprinter with the uploaded driver]] |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
* Connect the share "pdf" on your client. |
|||
⚫ | |||
= Solving problems = |
= Solving problems = |
||
* Apparmor prevents reading cups-pdf-raw.conf and writing to /srv/samba/pdf_output. |
|||
If the PDF isn't stored in its destination, enable the logging option of the script. |
|||
Edit /etc/apparmor.d/usr.sbin.cupsd |
|||
Add below before "}" the next two lines: |
|||
/etc/cups/cups-pdf-raw.conf r, |
|||
/srv/samba/pdf_output/* rw, |
|||
* Restart apparmor |
|||
[PDFprinter] |
|||
# systemctl restart apparmor |
|||
⚫ | |||
print command = /usr/local/bin/Pdfprint.sh ..... -l /var/log/samba/Pdfprint.log |
Latest revision as of 08:14, 5 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
- Samba configured as a Print Server
- CUPS installed
- package cups-pdf installed
Setup
- Install a new cups-pdf printer on CUPS (We consider that there is already a cups-pdf printer dedicated to linux clients with PPD linux driver, so we will create a second cups-pdf printer with RAW driver for windows clients)
- Add a new printer in the CUPS web interface (Warning: Only cups-pdf v3.0 and later can create multiple pdf printers)
Choose "CUPS-PDF (Virtual PDF Printer)" Name : Virtual_PDF_Printer_raw Description : Virtual PDF Printer Raw (or something else) Location : CUPS (or something else) Do not select "Share this printer" Brand : "Raw" Model : "Raw queue"
- Change the URI of the new cups-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 cups-pdf printer created
In /etc/cups/ make "cp cups-pdf.conf cups-pdf-raw.conf" Edit /etc/cups/cups-pdf-raw.conf Change to "Out /srv/samba/pdf_output" Uncomment "Label 2" (to avoid pdf files with the same name)
- 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 if necessary):
[PDFprinter] path = /var/tmp printer = Virtual_PDF_Printer_raw comment = Virtual PDF Printer raw (or something else) printable = yes
The above section is not necessary if you use "load printers = yes" in your smb.conf
[pdf] path = /srv/samba/pdf_output read only = no hide unreadable = yes
- Reload Samba
# smbcontrol all reload-config
- 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 "PDFprinter" on your client.
- Connect the share "pdf" on your client.
- Simply send a print job to the PDFprinter and the PDF is stored in the shared directory "pdf" with the domain user permissions.
Solving problems
- Apparmor prevents reading cups-pdf-raw.conf and writing to /srv/samba/pdf_output.
Edit /etc/apparmor.d/usr.sbin.cupsd Add below before "}" the next two lines: /etc/cups/cups-pdf-raw.conf r, /srv/samba/pdf_output/* rw,
- Restart apparmor
# systemctl restart apparmor