# printing from 13.0



## Todd McComb (Oct 12, 2021)

So I was on 12.2 only very briefly with this system before discovering that my new hardware required 13.0 in order to run Xorg.

But I could have sworn that lpt0 was recognized under 12.2. Under 13.0, it is not. No ppbus0 at all.
(E.g. /dev/lpt0 does not exist, not in dmesg, etc.)

So I thought, well, I can get with the 21st century and use USB, and indeed it's promptly recognized:

```
Oct 11 15:37:16 pangkur kernel: ugen0.2: <Hewlett-Packard hp LaserJet 1320 series> at usbus0
Oct 11 15:37:16 pangkur kernel: ulpt0 on uhub0
Oct 11 15:37:16 pangkur kernel: ulpt0: <Hewlett-Packard hp LaserJet 1320 series, class 0/0, rev 1.10/1.00, addr 1> on usbus0
Oct 11 15:37:16 pangkur kernel: ulpt0: using bi-directional mode
```
And then /etc/printcap (where I just add the 'u' in front of lpt0 from my old printcap that worked in earlier versions):

```
lp|local line printer:\
        🇸🇭\
        :lp=/dev/ulpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
```
So what happens?

Well, this is a postscript printer, but it seems I can't get e.g. firefox or xpdf to generate postscript anymore!  All they offer me is PDF files, and then there's no way to print a PDF.  (If I try with 'lpr' directly, I get many pages of gibberish.)

At first I thought my printer wasn't working right, or I was doing something wrong, but now I'm realizing that ways to generate postscript are disappearing.  There's no pdf2ps anymore either, etc.

So I'm confused.  What is going on?


----------



## Alain De Vos (Oct 12, 2021)

For a HP IP printer i installed the following packages,

```
hplip-3.20.6                   Drivers and utilities for HP printers and All-in-One devices
foomatic-db-20210822           Database for integrating printer drivers with common spoolers
foomatic-db-engine-4.0.13,2    Foomatic database engine
foomatic-db-hpijs-1.4          Foomatic data for the HPIJS printer drivers
cups-2.3.3op2                  Common UNIX Printing System
cups-filters-1.28.10           Additional backends, filters and other software for CUPS
cups-pdf-3.0.1_1               Virtual printer for CUPS to produce PDF files
```


----------



## Todd McComb (Oct 12, 2021)

Are you saying that you can directly print a PDF with those packages?

As far as the printer itself, I have been using it on FreeBSD for decades.  Until now, with 13.0.  (Still, though, I can print e.g. an ASCII file with a2ps.  But no useful output from xpdf, firefox, etc.  Only PDF!)


----------



## Todd McComb (Oct 12, 2021)

Further update.  So instead of the default xpdf package, I remembered there is xpdf3.  I installed that, and it has a "print" button.  (Note the default xpdf has no "print" button!)  And xpdf3 will write postscript (.ps), which my printer understands.

So I still don't understand, but I can now print a pdf (& so a web page, etc.).


----------



## Todd McComb (Oct 12, 2021)

The question about why no lpt0 recognized on 13.0 still stands also.


----------



## gpw928 (Oct 12, 2021)

The lpt(4) device is supported in the GENERIC kernel.  It would help to know a little more about your lpt0.  Do you actually have a physical parallel port on both devices?
When using a PostScript printer, the lpr/lpd system needs filters to convert your input to PostScript.  See the handbook.

A common alternative is to install the print/cups package.  Then download the HPLIP tar package and extract the specific ppd file for your HP printer model into the directory /usr/local/etc/cups/ppd/.  Then configure CUPS to use it.  CUPS will auto-detect the input type and do what's required.

Cups and lpr/lpd do not play together nicely.  Cups installs binaries in the /usr/local tree with the same names as the original lpr/lpd (lpr, lpq, and lprm) utilities.  All cups utilities have System V equivalent names (e.g. lp, lpadmin, lpstat, and cancel). Anyone using cups on FreeBSD should consider using them exclusively (since lpr/lpd is part of the base system and cant be easily removed).

The pdf2ps utility is installed with any of the ghostscript ports you may choose to install:
	
	



```
$ find /usr/ports -type f -name pkg-plist -exec grep -i -l pdf2ps {} \;
/usr/ports/print/ghostscript7-base/pkg-plist
/usr/ports/print/ghostscript9-agpl-base/pkg-plist
/usr/ports/print/ghostscript8-base/pkg-plist
/usr/ports/print/ghostscript9-base/pkg-plist
```


----------



## Alain De Vos (Oct 12, 2021)

I had to try a few ppd's from : 





						Printer List | OpenPrinting - The Linux Foundation
					






					www.openprinting.org


----------



## Todd McComb (Oct 12, 2021)

Yes, I have a parallel port on both devices.  As I said, this is new hardware, except the printer, which I have used successfully with FreeBSD (lpd/lpr system) since the 90s. And I thought that 12.2 recognized lpt0, but perhaps I have that wrong. It definitely worked fine in my 10.x system being replaced.


----------



## Todd McComb (Oct 12, 2021)

But I also see what everyone is saying in that e.g. firefox tries to use cups, and that is what is giving me only PDF as an option.  I would be happy if it would just let me write to .ps & then I print the file directly myself....

These are really two separate issues to do with printing, about the apps & formats, and about the hardware detection.


----------



## covacat (Oct 12, 2021)

you can install ghostscript and use pdf2ps as a filter


----------



## Todd McComb (Oct 12, 2021)

As noted, the xpdf3 package will also print directly to a postscript printer like mine. It comes with a similar "pdftops" utility. However, both xpdf3 & ghostscript are on their way out.  (I used to install & use gs as a filter back in the days *before* I had a postscript printer. Its main purpose is to read postscript.)


----------



## Todd McComb (Oct 12, 2021)

Maybe I should ask a different question. What sort of input does a contemporary printer expect? Not postscript? Perhaps that explains my situation.


----------



## covacat (Oct 12, 2021)

the better ones can print pdf 
the cheap ones only proprietary raster formats


----------



## Todd McComb (Oct 12, 2021)

OK, so if you can dump a PDF straight to a new printer, then that explains a lot about what I'm seeing.


----------



## gpw928 (Oct 12, 2021)

Todd McComb said:


> However, both xpdf3 & ghostscript are on their way out.


I don't understand why you think ghostscript is on the way out...

Like you, I ran lpr/lpd to my HP4050n for decades.  It was set up to spool and print PostScript.  It required a small filter for `lpd` to connect over the network.  I had a collection of applications like graphics/xpdf, print/enscript-a4, and print/psutils that I used to manually convert various inputs to PostScript, prior to sending them to the printer.

The problem with PostScript is that it's not a static target.  There are various levels and quirks that will prevent many forms of "postscript" from printing on your specific printer.  My main problem was that the HP4050n is limited to Level 2 PostScript.  It does not support Level 3.  I frequently had problems printing "postscript" documents, and would have to manually convert them, sometimes to Level 1 (essentially bitmap), and that would fail to print for other reasons (huge files, 10MHz Ethernet, limited internal memory).

The reason I recommended the ppd files form the HPLIP tar package is because they are produced by HP who also make the printers and write the firmware.  The ppd files manage the quirks and Level differences, and do work, extremely well.  Since I switched to CUPS with the HP ppd file, it's acutely rare for me to have a problem printing anything.

For the sake of completeness I should add that there is a FreeBSD print/hplip port available (the HPLIP tar package mentioned above with FreeBSD patches applied).  The package description says "HPLIP is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux.".  I have never used it (except to purloin the ppd files), but expect it may be a competent alternative to CUPS.

Edit: I never really wanted CUPS, but it's a dependency of so many things in the ports tree that it is frequently dragged in.  So I surrendered, and tried it out.  I'm now happy that I did.


----------



## diizzy (Oct 12, 2021)

Having a quick look it should support PCL5e and PCL6 (PCL5e uses less memory so it's probably a better idea to try that first) which should work fine using CUPS and/or HPLIP


			https://hp.it-shop.bg/uploaded/5/6/lj1320.pdf


----------



## Todd McComb (Oct 12, 2021)

OK, "surrender to cups" ... will put that on the possible to-do list. 

(You are right that not everything has printed perfectly over the years, but it's managed e.g. airline tickets, so I've been satisfied.)


----------



## astyle (Oct 15, 2021)

Todd McComb said:


> OK, "surrender to cups" ... will put that on the possible to-do list.
> 
> (You are right that not everything has printed perfectly over the years, but it's managed e.g. airline tickets, so I've been satisfied.)


If you want an airline ticket these days, use the airline's app on your phone. No more fumbling around for crumpled paper in your pockets while trying to hold a suitcase while standing in line for a TSA inspection.


----------



## grahamperrin@ (Apr 11, 2022)

diizzy said:


> … HPLIP …





Bluey said:


> … Gnome doesn't like HPLIP system tray app. …



Does *AppIndicator and KStatusNotifierItem Support* work around the problem?

<https://old.reddit.com/comments/7t67r4/-/dtb2hbm/?context=5>


----------



## grahamperrin@ (Apr 11, 2022)

Todd McComb said:


> … instead of the default graphics/xpdf package, I remembered there is graphics/xpdf3. I installed that, and it has a "print" button. …



Versions 3.04_11 and 4.03_1,1, pictured:


----------



## Bluey (Apr 11, 2022)

grahamperrin said:


> Does *AppIndicator and KStatusNotifierItem Support* work around the problem?
> 
> <https://old.reddit.com/comments/7t67r4/-/dtb2hbm/?context=5>


Sorry, have abandoned Gnome as having too many issues. Still have plenty of other issues with KDE/Plasma5 but it seems best of the bunch...


----------



## Deleted member 70435 (Apr 12, 2022)

well I run FreeBSD 10 12 13 normally I'm using FreeBSD 12 running xorg in great shape this week a lot of updates came out


----------



## bakul (Apr 12, 2022)

You can use pdf2ps (from ghostscript). cups can be handy but you don't have to use it as it will be one more thing you have to configure! From firefox you can just create a pdf file and then pipe it through pdf2ps before handing it to lpr.

No idea why /dev/lpt0 doesn't come up.


----------



## Bluey (Apr 12, 2022)

bakul said:


> [...] cups can be handy but you don't have to use it as it will be one more thing you have to configure! [...]


I suspect CUPS is fairly robust. Device independent postscript laser printing has been around for decades from the beginning.

20 yrs ago I used CUPS on mac mini "thin client" to talk to ethernet Samsung laser printer which wasn't "supported" and driven by RDP printer redirection. It was pretty simple to follow the directions and operated with no issues forever. (But the techs we had trying to replicate the setup managed to nuke MacOS and had to reinstall.)


----------



## astyle (Apr 12, 2022)

Bluey said:


> I suspect CUPS is fairly robust. Device independent postscript laser printing has been around for decades from the beginning.
> 
> 20 yrs ago I used CUPS on mac mini "thin client" to talk to ethernet Samsung laser printer which wasn't "supported" and driven by RDP printer redirection. It was pretty simple to follow the directions and operated with no issues forever. (But the techs we had trying to replicate the setup managed to nuke MacOS and had to reinstall.)


For me, if a printer is supported by CUPS, FreeBSD will take it like a champ, no stinkin' RDP redirection needed.


----------



## scottro (Apr 13, 2022)

For ps files (after using pdf2ps),  I use (gotten from these forums I think) netcat.

```
nc <printer IP> 9100 <file.ps
```
9100 is the standard jet direct port, most printers seem to listen on it.


----------



## astyle (Apr 13, 2022)

scottro said:


> For ps files (after using pdf2ps),  I use (gotten from these forums I think) netcat.
> 
> ```
> nc <printer IP> 9100 <file.ps
> ...


This suggests to me that even if a modern printer doesn't have a CUPS driver, if it has an IP address, you can still try printing something to it. That does have pitfalls, such as not having much control over font size, pages, and a lot of other details that make printouts look OK. Well, I personally don't do much printing these days, and even the term 'paperwork' is slowly becoming a history-laden reference to the process of lining up tags in databases, without much actual paper involved.


----------



## bakul (Apr 13, 2022)

scottro said:


> For ps files (after using pdf2ps),  I use (gotten from these forums I think) netcat.
> 
> ```
> nc <printer IP> 9100 <file.ps
> ...


I think you can put "lp:9100@printer-IP:" in /etc/printcap instead of netcat. See the example in § 9.5.4 of the handbook: https://docs.freebsd.org/en/books/handbook/printing/
The whole chapter is worth reading!


----------

