# Cups headaches again.



## Snurg (Mar 22, 2021)

I seem unable to get printing via Cups work.
What I have done so far:

Installed cups after pkg update upgrade.
Set up the printer (same settings as on Linux, where it just works).
Manufacturer-supplied PPD file is installed in the printer config.

I am unable to print, getting the error "cannot connect to printer" from LibreOffice and other programs.
From the Cups admin panel there is option "Print test page".
When I choose this, there appears some message about missing file. (apparently test page file)
When I choose "Print PrinterSelf Test page", this works.

When I choose in Configure Options: "Get Defaults from printer", I get an error:

```
Set Default Options kyo Error
Unable to send command to printer driver:
Not allowed to print.
```

Config is FreeBSD 12.2-RELEASE-p2.
Printer is Kyocera, connected via Ethernet through the FreeBSD 12.1-RELEASE router.
PF is set to pass tcp jetdirect to printer IP.
Never experienced a printing problem with Linux computers, so I guess the problem is in my FreeBSD computers' Cups installation or configuration..

Any idea what I am doing wrong?
Where could I look next?


----------



## tuxador (Mar 23, 2021)

Mysteriously libre Office often fails in printing while printing pdf is okay.
My workflow uses TeX (actually Luametatex a newer version of ConTeXT) so my reports are PDFs, but when I use libre Office I run into this issue.
Try to convert your document into pdf and print it.


----------



## Snurg (Mar 23, 2021)

Thank you very much tuxador!
I tried exporting to PDF and then to print from Okular... bingo, it worked! 

BTW, yesterday I found there is an utility cups-config(1).
The man page is interesting!
Looks like you can easily integrate your homebrew filters into cups.
Maybe the problems' cause is just a filter issue... need to look into that when I got time.


----------



## tuxador (Mar 23, 2021)

Snurg said:


> Thank you very much tuxador!
> I tried exporting to PDF and then to print from Okular... bingo, it worked!
> 
> BTW, yesterday I found there is an utility cups-config(1).
> ...


I am using the ippeverywhere generic driver for my canon mf 635cx printer, I dunno if it's filter related.


----------



## sidetone (Mar 23, 2021)

I was reading that OpenOffice then (now either LibreOffice or Apache Open Office) offered its own drivers. So printing from it wouldn't work with the typical LPR drivers or Ghostscript software already set up on a FreeBSD system for Postscript output. Likely it's the same for CUPS (which takes care of more printers than LPR), or whatever other driver is set up as the default on FreeBSD.

OpenOffice (more than likely the same for LibreOffice) drivers had to be set up independently of whatever drivers or filters you already have set up on your FreeBSD system. This likely hasn't changed since then.

Most programs simply output data in Postscript format, which CUPS, LPR or Ghostscript can also take care of.

The basis of this information is from FreeBSD 6 Unleashed (published about 15 years ago).

I imagine, this could be the same instance for GIMP, which uses Gutenprint drivers.


----------



## decuser (Mar 28, 2021)

Thankfully, CUPS just works for me on FreeBSD ... particularly after I carefully follow the recipe I worked out back in 2010ish that includes a script to fix permissions, edit my system make.conf, add my user to cups group, edit rc.conf, and devfs.rules, add my printer in the web interface, set duplex, letter, and the ppd file, and ...

One thing that really helps with cups,  is debug mode and the log:

`sudo cupsctl --debug-logging
tail -f /var/log/cups/error_log`


----------



## sko (Mar 30, 2021)

Kyocera printers are a major PITA and deserve to die in a fire. We've had several Kyocera color laser printers (FS-C5150DN were the last models) and if they didn't get the data *exactly* in the format they prefer with *exactly* the weird kinks kyocera likes they would either not print at all or spit out garbage until the paper tray is empty. I therefore hate kyocera with a passion - never had more troubles with printers, regardless of the OS.

That being said - the KPDL drivers usually "mostly worked" for me, but some printers only worked with PCL3 drivers. IIRC using jet direct (socket @ port 9100) was usually less painful (i.e. more likely to work) than ipp.
The printers still acted "undefined" when throwing e.g. bigger files at them or sometimes they just won't print a particular pdf or other document until I stored it into another format and printed that or even just rotated an image 180°. As for Windows, we are running a Java application that could reliably trip any of the Kyocera color laser printers we had when printing directly from that application - the printers would just spit out garbage until the paper tray was empty if you didn't switch them off. This was regardless of the printer driver you chose in the application (postscript, pdf, pcl...) - but showing a pdf preview and printing that worked. That's especially annoying when you have users with the average long-term memory of a lobotomized goldfish (yes, I've got calls about this exact problem at least 2-3x a month...).
I haven't seen any of those annoying quirks again since we switched to brother printers which just seem to print anything you throw at them...

I still have one of the FS-C5150DN configured at my workstation, so if you happen to have this/a compatible model I can share the full config and ppd if you want.


----------



## free-and-bsd (May 4, 2021)

Well, printing from LibreOffice via LPR using command line, for example, works this way. This file was used in former versions where printing from command line was supported. ~/.config/libreoffice/$major_versin(6,7 etc)/psprint/psprint.conf looks like this:

```
[Samsung Printer]
Printer=SGENPRT/Samsung
Location=my-home
Comment='Samsung printer'
Command=lpr -Plp

[Duplex Printer]
Printer=SGENPRT/Samsung duplex
Location=my-home
Comment='Samsung duplex'
Command=lpr -Pdup

DefaultPrinter=0
```
Which tells LibreOffice to use my Samsung printer through lpr command line. Which, in turn, uses two entries in /etc/printcap that define filters for non-duplex and duplex printing. And a well-commented template for this file is found at /usr/local/lib/libreoffice/share/psprint/psprint.conf. So, I don't know how you make this work with CUPS since I'm using good old LPR with some little filters. But I guess this can be done, the mechanism is there, at least.


----------

