# Easy way to use a PCL printer with lpd



## teckk (Dec 29, 2010)

This is a easy alternative to using a PCL printer without CUPS if you don't care for it. If you are going to use lpd printing on a PCL printer you need the right filter. If you can find out what driver works with your printer for Linux then you can use ghostscript to print the .ps file through a PCL filter and on to your printer.

I recently got a good clean Brother HL-1440 lazer printer given to me.

As you can see from here
http://www-01.ibm.com/support/docview.wss?uid=nas1d1817a5251ba1e4b862569c100799559
It is an HP PCL 4 data stream printer.

I found the Brother released Brother-HL-1440-hl1250.ppd file for Linux. In it is a line

```
gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=hl1250 -sOutputFile=
```
So I looked at

```
gs -help
```
Sure enough the hl1250 is listed.
So I plugged the printer in and established which port it would print on. (dmesg)

I saved a document as a .ps file. Most apps will. Firefox, AbiWord, OO, etc.
You could also use pdf2ps, a2ps,.....make the file .ps because that what gs wants.

So I then issued

```
su
gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=hl1250 -sOutputFile=/dev/unlpt0 myfile.ps
```
And the page printed just fine. I became root because only root has perms to /dev/unlpt0 unless you do some changes. Another USB printer I use works on /dev/ulpt0.

You can also use gs to print to file, a PCL file. This takes your myfile.ps and makes a myfilePCl

```
gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=hl1250 -sOutputFile=myfilePCL myfile.ps
```

Now the file is in PCl format so just cat it to the printer.

```
cat myfile > /dev/unlpt0
```

You can also set up lpd printing, make a printcap file with your ghostscript filter and use lpr. You'll have a print cue.

```
printf myfilePCL | lpr
```

You can also use ggv as a front end to ghostscript8. It works good.
Then you can save a file as file.ps
Open ggv and print the file to the lpr printer. Slick.

gs()
gs -help
cat()
printf()


----------



## wblock@ (Dec 29, 2010)

There's a filter called ps2pcl described in my lpd Printing With FreeBSD article.

Incidentally, I would not use printf(1) for sending random output to lpr(1); there's a possibility that the text would have sequences that would be wrongly interpreted by printf.  But you don't really need it, either.  lpr can take a file as a parameter:
`% lpr myfilePCL`


----------



## teckk (Dec 29, 2010)

Ok thanks for that info.
http://www.wonkity.com/~wblock/docs/html/lpdprinting.html 
I made a .pdf out of that a while back. I didn't quite get it to work. Found out later that I had a bad gs install. I did a force portupgrade of ghostscript8 and it started working correctly. That's what made me revisit it.

That's what I ended up with.

1 enable lpd

2 Made a ps2pcl in /usr/local/libexec

```
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=hl1250 -sOutputFile=- -
```

3 Edited my /etc/printcap

```
# My additions
lp:\
     :lp=/dev/unlpt0:\
     :sh:\
     :mx#0:\
     :sd=/var/spool/lpd/lp:\
     :if=/usr/local/libexec/ps2pcl: \
     :lf=/var/log/lpd-errs:
```
 

Just about any app will save a file as .ps. If not it's easy to convert it.
Then I open up the file in ggv and print to lpr. One has a .ps copy of the file to save or print later.

I think that is a slick way of doing it. It's also much easier than setting up CUPS.

Also by experiment found that dmesg put the Brother HL-1440 at /dev/ulpt0. The printer would run but not feed any paper or print. So I tried /dev/unlpt0 and of course that works fine.


----------

