# printing text to network printer



## zorb847 (Mar 10, 2017)

I think this is a printer problem, not a network problem
I am new to FreeBSD and don't understand something - please be patient.
I have an old OKIdata ML192 printer that I would like to be able to use just to use to print plain text files.
I have followed the instructions in the handbook and my /etc/princap is:

```
lp:\
        :lp=/dev/lpt0:\
        :sh:\
        :mx#0:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/log/lpd-errs
```
lpd is enabled in /etc/rc.conf l
	
	



```
lpd_enable="YES"
```
 and lpd is running
If I type
`printf "1. This printer can print.\n2. This is the second line.\n" | lpr`
everything works as expected - prints out the 2 lines OK
I can also do
`ls -l | lpr`
and all works as expected.
My problem is coming in because I would like to have access to this printer over the network
I have a TP-LINK model TL-TS109P print server plugged into the printer and changed the second line of my /etc/printcap file to:


```
lp=:rm=1P_PrintServDC7577:rp=raw:\
```
Then rebooted
I can ping it by name "1P_PrintServDC7577"

However when I try to run the test, or print out any kind of text file,
the output is totally garbled.
I went through all the settings of the print server and don't see any thing that might make a difference. Any help greatly appreciated.

11.0-RELEASE-p1
11.0-RELEASE-p1


----------



## shepper (Mar 10, 2017)

I think it is a network problem. See sections 9.4 and 9.5.  Your /etc/host will also need an entry to resolve "1P_PrintServDC7577" to a network address.

The IP address port also matters.

My /etc/hosts

```
192.168.2.3     Brother.home.yak   Brother
```

And /etc/printcap

```
# Default Network printer US letter
lp:\
    :lp=9100@Brother.home.yak:\
    :if=/usr/local/libexec/br_script:\
    :sd=/var/spool/output/lpd:\
    :lf=/var/log/lpd-errs:\
    :mx#0:\
    :sh:
```


----------



## zorb847 (Mar 11, 2017)

I have tried your suggestions without any luck but I do notice something strange that I don't understand.
I renamed my printserver to OKI just to make things easier and made the appropriate changes in my /etc/hosts
I can ping it by `ping OKI`
I have the appropriate line in my /etc/printcapfile as per instructions in the end of the printcap file which says:
# For a printer connected directly to a network, use:
#:lp=:rm=network-printer-name:rp=raw:\
Mine is
	
	



```
:lp=:rm=OKI:rp=raw:\
```
I created a text file called abc.txt and put in it the lower case letters from a-z.
When I do `lpr abc.txt`, the printer prints out "bdfhjlnprtvxz" - every time.
There is a web interface to this print server and if I look at the print jobs section, I see that it has printed a job of 27 bytes which makes sense because the file is 27 bytes.
The printout is 13 bytes - about half. It looks like it is discarding ever other byte.
What could possibly cause this?
I don't see any kind of configuration in the print server control that would cause this.
Also, when I connect the printer to the parallel port and make the proper change in the /etc/printcap file, all works perfectly.
I don't get it!


----------



## shepper (Mar 11, 2017)

What happens if you do a quick test to see if your printserver supports HP Jetdirect port?
`# nc [I]OKI[/I] 9100 < abc.txt`


----------



## zorb847 (Mar 12, 2017)

I have just done this 
`nc [I]OKI[/I] 9100 < abc.txt`
with same results - every other character not printed.
Seems like communication problem between print server and printer but they are plugged directly into each other.
??? This is no kind of emergency but I am now determined to figure out what is going on.


----------



## shepper (Mar 12, 2017)

What made me think it was a Network problem was that the print job was getting corrupted when sent through the print server.  I looked at the manual for a TLPS110P and it does have a configuration tab under Setup -> Printer where you specify the printer language. I'm thinking that your dot matrix printer is simply a line printer and should take a "raw" text file. The other thing I saw was that this vintage of printer had DIP switches and that they needed to match the input.  Otherwise I'm out of ideas.


----------



## wblock@ (Mar 12, 2017)

That's an Okidata impact printer connected by parallel port to the print server?  I've dealt with those.  There is some weird interface or timing issue.  At the time, I had to change either a DIP switch setting on the printer or something on the print server to get it to work properly.  Dim memory suggests it was something to do with the timing while the print head was seeking back to the beginning of a line, and allowing extra delay at the end of line fixed it.  This was something like ten years back, so the printer and configuration are long gone.


----------



## zorb847 (Mar 13, 2017)

If anyone is interested, I was able to fix it

There are dip switches inside printer but made no difference.
There is a config.txt file on the print server that I was able to tftp to.
Then <get> and there is a line that says <PrinterMode> which was set to fast and I changed it to normal.
Then <put> back

config.txt

01 BoxName      : OKI
02 BoxVersion   : 8.03 (fixed)
03 BoxNodeID    : 30-B5-C2-DC-75-77 (fixed)
04 DHCP/BOOTP   : ON
05 BoxIPAddress : 192.168.1.3
06 Gateway      : 192.168.1.1
07 SubnetMask   : 255.255.255.0
08 NetWare      : Disable
09 PrinterMode  : Normal (Fast, Normal, Slow) <<<<<changed from Fast to Normal
10 Printer1Name : lp1 (fixed)

Now works fine
Thanks shepper and wblock for your posts


----------



## shepper (Mar 13, 2017)

Strong work and more importantly, you documented the solution


----------

