Setting up CUPS-PDF on a Linux instance
I need to print-to-PDF often, and often from encrypted or otherwise protected PDF forms, for e-filing. CUPS-PDF for OS X used to work, but no longer. My solution is a bit ham-fisted, but it works: I setup a simple CentOS 7 instance under VMware and simply print to that. Steps:
# ifup ens33
Download the Installer and Setup CentOS
I used CentOS-7-x86_64-Minimal-1908.iso under VMware Fusion 8, with a virtual machine setup with 1GB RAM and a 20GB virtual hard drive, to setup an instance named: CentOS 64-bit Printing.vmwarevm
I have it setup to use “bridged” networking (at least initially?) so I can SSH into it, which of course requires sshd to be running (and the installation of some basic stuff the minimal install leaves out):
# vi /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT=yes# ifup ens33
# yum provides "*/ifconfig"
# yum install -y net-tools telnet wget vim
Install EPEL and CUPS-PDF
Browse to http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/ and get the link to the latest epel-release package (as of this writing, epel-release-7-12.noarch.rpm); download and install:
# wget 'http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm'
# yum install -y ./epel-release-7-12.noarch.rpm
# yum install -y cups-pdf
Open the IPP port (631) to the LAN and allow a regular user (in this case admin) to administer CUPS:
# firewall-cmd --zone=public --list-services
dhcpv6-client ssh
# firewall-cmd --permanent --zone=public --add-service=ipp
success
# firewall-cmd --permanent --zone=public --add-service=ipp-client
# firewall-cmd --permanent --zone=public --list-services
dhcpv6-client ipp ipp-client ssh
# vi /etc/cups/cupsd.conf
Listen 0.0.0.0:631
...
# service cups restart
<Location />
Order allow,deny
Allow localhost
Allow from 192.168.*.*
</Location>
....
<Location /admin>
Order allow,deny
Allow localhost
Allow from 192.168.*.*
</Location>
...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM admin
Order allow,deny
</Location>
....
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM admin
Order deny,allow
</Limit>
Browse to the Linux instance, port 631, in a web browser (e.g., on my LAN, it's https://23.75.345.200:631). At the top, select the “Administration” tab (https://23.75.345.200:631/admin), and under that tab, click the Add Printer button under Printers. (The PPD file used is the one for the Color LaserWriter 12/660 PS.)
Add Printer
(•) CUPS-PDF (Virtual PDF Printer)
...
Name: Virtual_PDF_Printer
Description: Virtual PDF Printer
Location: CentOS 7 VM
Connection: cups-pdf:/
Sharing: [✓] Share This Printer
Provide a PPD File: aplwcsb1.ppd
Probably worth editing that PPD file as follows:
(Allows printing the whole page, which makes sense in an electronic setting where physical printer limitations aren’t a factor.)
Memory Configuration: 40 MB Upgrade
Cassette (Optional): Not Installed
This will create the printer Virtual_PDF_Printer. Under https://23.75. 345.200:631/printers/Virtual_PDF_Printer, under the Maintenance drop-down menu, select “Print Test Page.”
It should be in the home directory of the user used to access the CUPS interface (e.g., /home/admin/):
Add Printer
Add Printer
(•) CUPS-PDF (Virtual PDF Printer)
...
Name: Virtual_PDF_Printer
Description: Virtual PDF Printer
Location: CentOS 7 VM
Connection: cups-pdf:/
Sharing: [✓] Share This Printer
Provide a PPD File: aplwcsb1.ppd
Probably worth editing that PPD file as follows:
*%*ImageableArea Letter/US Letter: "14.16 14.1601 597.84 769.32 "
*ImageableArea Letter/US Letter: "0 0 612 792 "
Memory Configuration: 40 MB Upgrade
Cassette (Optional): Not Installed
This will create the printer Virtual_PDF_Printer. Under https://23.75. 345.200:631/printers/Virtual_PDF_Printer, under the Maintenance drop-down menu, select “Print Test Page.”
It should be in the home directory of the user used to access the CUPS interface (e.g., /home/admin/):
# cat /var/log/cups/cups-pdf_log
Tue Apr 7 12:53:33 2020 [STATUS] identification string sent
Tue Apr 7 12:57:40 2020 [STATUS] identification string sent
Tue Apr 7 13:05:41 2020 [ERROR] Can't read (/home/admin/.config/user-dirs.dirs)
Tue Apr 7 13:05:45 2020 [STATUS] PDF creation successfully finished (/home/admin/Test_Page.pdf)
# file /home/admin/Test_Page.pdf
/home/admin/Test_Page.pdf: PDF document, version 1.4
# ls -lh /home/admin/Test_Page.pdf
-rw-------. 1 admin admin 311K Apr 7 13:05 /home/admin/Test_Page.pdf
Setup the Printer on the Mac
Browse to https://127.0.0.1:631 in a web browser on the Mac client, go to the Administration tab, and under Printers, click the Add Printer button. Login using an Administrator user on the Mac.
(•) Internet Printing Protocol (http)
Connection: http://23.75.345.200:631/printers/Virtual_PDF_Printer
Name: VM_CUPS
Description: CUPS-PDF on VM
Location: CentOS 7 VM
Connection: http://23.75.345.200:631/printers/Virtual_PDF_Printer
Sharing: [ ] Share This Printer
Description: CUPS-PDF on VM
Location: CentOS 7 VM
Connection: http://23.75.345.200:631/printers/Virtual_PDF_Printer
Sharing: [ ] Share This Printer
Provide a PPD File: aplwcsb1.ppd
Memory Configuration: 40 MB Upgrade
Cassette (Optional): Not Installed
Cassette (Optional): Not Installed
Print a test page from here, too. It should be created under /var/spool/cups-pdf/ANONYMOUS on the Linux instance:
# cat /var/log/cups/cups-pdf_log
Tue Apr 7 13:18:13 2020 [STATUS] directory created (/var/spool/cups-pdf/ANONYMOUS)
Tue Apr 7 13:18:14 2020 [STATUS] PDF creation successfully finished (/var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf)
# ls -lh /var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf; file /var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf
-rw-rw-rw-. 1 nobody nobody 55K Apr 7 13:18 /var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf
/var/spool/cups-pdf/ANONYMOUS/Test_Page.pdf: PDF document, version 1.4
Comments
Post a Comment