I’m posting this on the chance it can save others some of the problems I’ve had transitioning from CUPS 1.7.5 on Leap 42.1 to CUPS 2.2.7 on Leap 15.1 – problems not completely unexpected given the amount of time between the versions.
Caveat/warning: I am not even close to being an expert on CUPS. But after much reading and experimentation I have a solution that works for me, one that’s significantly different than those installed and configured by YaST from RPMs advertised to match the printer. Also, although this was done for a Lexmark MS312dn laser printer, I believe many of the details should be generic to all PostScript printers. As always, YMMV.
TL;DNR/Solution:
- Install – by YaST, CUPS, or manually – a good PPD file into /etc/cups/ppd
- Remove any non-commented lines (comments begin with “^%”) that start with “*cupsFilter:”
- Insert the following two lines:
*cupsFilter: "application/postscript 50 gstopdf"
*cupsFilter: "application/vnd.cups-pdf 50 pdftops"
(but see below for another/better alternative).
4) Restart the CUPS server with YaST → Service Manager or with sudo systemctl restart cups
.
NLE;WTRM (“not long enough, want to read more”):
The thread https://forums.opensuse.org/showthread.php/537525-Printer-worked-on-42-1-now-quot-Unsupported-format-quot-on-15-1 details my initial problems setting up the Lexmark MS312dn. After much assistance from deano_ferrari the printer worked – at least inasmuch as it would print. However I subsequently found that when printing PostScript files with any but the most basic fonts, the “fancy” fonts would be replaced by “simpler” ones.
I was using a PPD from an RPM directly downloaded from Lexmark’s website. As per the above thread, printing (of any kind) only worked when I removed the “cupsFilter” lines from the PPD. Note I still don’t understand what filter rules CUPS uses when none are supplied in the PPD.
I eventually suspected that my Leap42.1/CUPS1.7 system was rendering the print jobs as bitmaps and sending those to the printer instead of PostScript, even though it is a PostScript printer (it can print PostScript directly). This was confirmed by finding use of “foomatic-rip” in the CUPS1.7 PPD (“rip” == “raster image processor”, a concept which BTW I was familiar with, just not the CUPS specifics). I had seen “foomatic” RPMs in the 42.1 system, but since there weren’t any similar ones for 15.1 (at least in the base repositories) I thought that wasn’t an option for the new CUPS 2.x release.
After much semi-successful experimentation, I decided to do a full reinstall of the printer with YaST. This time, again at deano_ferrari’s suggestion, I used an RPM from http://www.openprinting.org/printer/Lexmark/Lexmark-MS312dn. I did have some problems with the RPM despite having installed it with YaST → Software Management (possibly user error; it worked the second time I tried). Note that as per my “not an expert” disclaimer above, I don’t understand how YaST/CUPS modify and install RPM-provided PPD files (in this case /opt/OpenPrinting-Lexmark/ppds/Lexmark/Lexmark-MS310_Series-Postscript-Lexmark.ppd.gz) into the very different Lexmark-MS312dn-Postscript-Lexmark.ppd file which is directly downloadable from the OpenPrinting website. (I also don’t understand how YaST finds which installed RPMs contain PPDs, but that’s another unimportant issue.)
This newly-installed PPD did print “out of the box”, and it was using “foomatic-rip”, but once again the non-basic fonts were missing. In addition, there were some slight alignment/border/clipping issues not present in Lexmark’s PPD, so I decided to go back to that one as a starting point.
In the my previous thread I wrote, “Some kind of command, cups-config --filter-chain
that dumps the info would have helped.” After much reading I found there is such a thing: /usr/sbin/cupsfilter. Doing:
/usr/sbin/cupsfilter -e -p <path-to-PPD-file> -m printer/<name-of-printer/queue> --list-filters <some-printable-file>
will output the chain of filters CUPS will use to print the file. Then:
/usr/sbin/cupsfilter -p <path-to-PPD-file> -m printer/<name-of-printer/queue> <some-printable-file> > <file-that-CUPS-will-send-to-printer>
will allow testing the chain. This saves a tremendous about of copying into /etc/cups/ppd, restarting the CUPS server, and printing onto paper with the physical printer.
I came to the “TL;DNR” solution above because I felt there was no need to render a bitmap image to send to a printer that already understands PostScript. There are of course pros and cons to both approaches: PostScript requires sending much less data (although that’s probably not an issue), and whether ghostscript or the printer do a better job of rendering needs testing.
The even “better alternative” mentioned above is one I actually came up with first. I consider it an alternative for two reasons: 1) Apple/CUPS documentation states that CUPS is moving away from a PostScript-centric orientation to using PDF as its fundamental underlying format, and 2) It requires a custom (although simple) /usr/lib/cups/filter filter that I wrote. The method is:
*cupsFilter: "application/postscript 50 pstoembeddedfontsps"
*cupsFilter: "application/vnd.cups-pdf 50 pdftops"
The pstoembeddedfontsps filter is:
#!/bin/sh
# pstoembeddedfontsps - This is a Postscript-to-PostScript with
# embedded fonts filter for CUPS
#
GS=`which gs`
echo "DEBUG: pstoembeddedfontsps argv$#] = $@" >&2
echo "DEBUG: PPD: $PPD" >&2
if $# -lt 5 -o $# -gt 6 ]; then
echo "ERROR: $0 job-id user title copies options [file]" >&2
exit 1
fi
# Read from given file.
if -n "$6" ]; then
INPUT="$6"
else
INPUT='-'
fi
$GS -sDEVICE=ps2write -sstdout=%stderr -dEmbedAllFonts=true -dNOPAUSE -dBATCH -sOutputFile=- $INPUT
Any improvements to it would be welcomed, although it does work “as is”. I’ve tested both solutions on many different kinds of print jobs: PostScript, PDF, images (PNG, JPEG, PPM) using lp
from the commandline, plus printing directly from LibreOffice and Firefox. The only thing I’ve found that fails is plain text files with lp
– there are no errors, but nothing prints. I’m ignoring this problem for now as I prefer to use enscript
anyway , if not importing and interactively formatting the text using some more complex application.
That’s about it. I’ll try to answer questions if there are any, and again welcome any corrections to mistakes I’ve made. Also thanks again to deano_ferrari – I’ve learned far more about CUPS than I ever wanted to know, but in the end knowledge is always a good thing to have.