Re: cups-filters-1.27 problem? [Re: Input Filter and LPD]

2020-06-15 Thread Predrag Punosevac
Stefan Sperling  wrote:

> On Sun, Jun 14, 2020 at 02:58:18PM +0200, Marcus MERIGHI wrote:
> > i think this belongs to ports@. though base lpd(8) is in the Subject:, 
> > this is probably abount cups-filters-1.27 failing on us.
> 
> > $ cat /etc/printcap.sh
> > #!/bin/sh -e
> > /usr/local/bin/a2ps -BRq --columns=1 -o - | \
> > /usr/local/bin/foomatic-rip --ppd \
> > /etc/foomatic/direct/brother-mfc9120cn.ppd \
> > -P brother-mfc9120cn
> 
> Try removing a2ps from your filter script. This no longer works as the
> cups-filters readme file suggests.

We must have been reading the different cups-filters readme file. This
is on 6.7 release




$OpenBSD: README,v 1.11 2020/02/22 14:51:47 ajacoutot Exp $

+---
| Running cups-filters on OpenBSD
+---

Bonjour broadcasts of shared, remote printers
=

The cups-browsed(8) daemon can be used to browse Bonjour (mDNS)
broadcasts of remote printers and create/remove local raw queues
pointing to these printers. This requires the avahi-daemon(8) to be
running first. To start it at boot time, the rc.conf.local(8)
pkg_scripts line can be edited as follow:

pkg_scripts=[...] messagebus avahi_daemon cups_browsed [...]

lpd(8) using direct printing with foomatic-rip(1)
=

The Foomatic framework supports direct printing which does not rely on
CUPS (nor any spooler) and can thus be used with lpd(8).

Complete documentation can be found at:

http://www.linuxfoundation.org/collaborate/workgroups/openprinting/database/
nospoolerdocumentation

Foomatic configuration
--
A specific PPD file has to be created for the printer. Refer to the
documentation that comes with the foomatic-db-engine package to learn
how to generate PPD files
(cf. /usr/local/share/doc/pkg-readmes/foomatic-db-engine).

# mkdir -p /etc/foomatic/direct
# foomatic-ppdfile -p 'Samsung-ML-2850D' -d 'Postscript' >
/etc/foomatic/direct/samsung-ml2850d.ppd

Alternatively, you can look under
/usr/local/share/foomatic/db/source/PPD
for existing PPD files matching your printer (in which case the PPD file
can be copied and/or gunzip'd under /etc/foomatic/direct).

Input filter script
---
Non-postscript files must be converted before being sent to
foomatic-rip(1). Several packages can be used for that, a2ps being the
most complete.
Note that a2ps(1) requires external helper tools for converting files.
They can be configured under /etc/a2ps{,-site}.cfg. By default,
converting images requires the ImageMagick package.

Here's a sample converter script:

---8<---
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P samsung-ml2850d
---8<---

Additional options can be passed to foomatic-rip(1).
e.g.
- to print in duplex mode: -o duplex
- to set the page size to letter: -o pagesize=letter

Default options can be set by editing the PPD file.

To use the above script as an input filter for lpd(8), see the next
sections (make sure the script is executable).

lpd(8): USB printer printcap(5) example
---
lp|samsung|Samsung-ML-2850D:\
:lp=/dev/ulpt0:\
:if=/path/to/script.sh:\
:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:\
:sh:

lpd(8): network printer printcap(5) example
---
rp|samsung|Samsung-ML-2850D:\
:lp=9100@1.2.3.4:\
:if=/path/to/script.sh:\
:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:\
:sh:
(where 1.2.3.4 is the printer IP address and 9100 the printer stream
port)

foomatic-rip(1) does *not* speak LPD (port 515).
If the printer does not support raw printing over port 9100, it must be
setup locally on a print server (see above for an example using USB)
then accessed over LPD by the clients (there is no need to setup any
print filter on the clients since it will run on the print server).



I did try your suggestions and I didn't get raw PostScript but I didn't
get anything either. The printer kept printing blank pages.


> Removing the a2ps line fixed PDF printing for me after upgrading to 6.7.
> 
> Yes, that means printing plain ASCII files is broken. But that can be
> worked around by manually converting ASCII to PDF first. And because
> a2ps never worked correctly with UTF-8 it was rather useless anyway.

I am old enough to remember the times all PostScript printers could
print raw ASCII files without fiddling with filters or even a spooling
system. For the most part I don't need UTF-8 so that was not an issue
for me.  However, the native lpr command doesn't have a switch for
duplex printing. That is expected as lpd is only a 

Re: cups-filters-1.27 problem? [Re: Input Filter and LPD]

2020-06-15 Thread Stefan Sperling
On Sun, Jun 14, 2020 at 02:58:18PM +0200, Marcus MERIGHI wrote:
> i think this belongs to ports@. though base lpd(8) is in the Subject:, 
> this is probably abount cups-filters-1.27 failing on us.

> $ cat /etc/printcap.sh
> #!/bin/sh -e
> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
>   /usr/local/bin/foomatic-rip --ppd \
>   /etc/foomatic/direct/brother-mfc9120cn.ppd \
>   -P brother-mfc9120cn

Try removing a2ps from your filter script. This no longer works as the
cups-filters readme file suggests.
Removing the a2ps line fixed PDF printing for me after upgrading to 6.7.

Yes, that means printing plain ASCII files is broken. But that can be
worked around by manually converting ASCII to PDF first. And because
a2ps never worked correctly with UTF-8 it was rather useless anyway.



cups-filters-1.27 problem? [Re: Input Filter and LPD]

2020-06-14 Thread Marcus MERIGHI
i think this belongs to ports@. though base lpd(8) is in the Subject:, 
this is probably abount cups-filters-1.27 failing on us.

i do not snip anything, ports@-people see this for the first time.

for the misc@ thread see https://marc.info/?t=15916537163

punoseva...@gmail.com (Predrag Punosevac), 2020.06.09 (Tue) 16:28 (CEST):
> Marcus MERIGHI  wrote:
> > punoseva...@gmail.com (Predrag Punosevac), 2020.06.08 (Mon) 23:57 (CEST):
> > > It seems that there is another change on 6.7 perhaps among packages
> > > which broke printing for me. I am using built in LPD to print onto the
> > > network connected Brother HL-5250DN. I am getting row PostScript output
> > > on the printer instead of the document.
> > 
> > I think I've seen the same. Though I could still print simple text
> > files, like "cat foo.txt | lpr". 
> 
> Thanks for confirming the issue. I am 95% sure that this is related to 
> the upgrade of 
> 
> cups-filters
> 
> package.
> 
> Namely, there are two packages involved with my printing setup. 
> 
> a2ps and cups-filters
> 
> a2ps has not been changed since 6.6 relase and it is still the same old 
> 
> a2ps-4.14p15
> 
> However, cups-filters is significantly "upgraded". OpenBSD 6.6 was
> shipped with cups-filters-1.25.6. OpenBSD 6.7 was shipped with
> cups-filters-1.27.4p0. Looking through internet archive and the commit log 
> 
> https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/print/cups-filters/Makefile
> 
> cups-filters-1.27 branch was nothing but the trouble. I am not sure why
> upstream quickly ditched cups-filters-1.26. When I say trouble I really
> mean it. This thing broke printing on CentOS and Ubuntu not just on
> OpenBSD. 
> 
> 
> I upgraded my package to cups-filters-1.27.5 and that didn't fix the
> problems for me. I tried yesterday to go back to the last 1.25 version
> 
> cups-filters-1.25.13
> 
> I was unable to compile program quickly. It requires more work. I am
> surprised to find out that I am the first one reporting the issue as I
> would expect more people to use LPD than CUPS.

thanks, Predrag, for finding this out!
regarding LPD vs. CUPS I'm afraid it's the other way round :-(
 
> I fixed cups-filter package probably would be worth of stable binary
> package effort.
>
> > Printing PDFs from xournal failed, with raw PS output as you describe. 
> > 
> > The machine is currently not available, probably online this afternoon, 
> > will post the configs then. 

here we go, better late than never:

$ cat /etc/printcap
lp|brother-mfc9120cn|Brother-MFC9120CN:\
:lp=9100@brother:\
:if=/etc/printcap.sh:\
:sd=/var/spool/output/lpd:\
:lf=/var/log/lpd-errs:\
:sh:
$ cat /etc/printcap.sh
#!/bin/sh -e
/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip --ppd \
/etc/foomatic/direct/brother-mfc9120cn.ppd \
-P brother-mfc9120cn

Marcus