# Can not print from network printer

## lnthai2002

I have a HP Officejet 725 attached to my router(SMC7004ABR) by parallel port on the router. I followed the instruction here to set up my printer: http://www.gentoo.org/doc/en/printing-howto.xml#setup_remote. I thought i have to use IPP to print so i emerge CUPS with nls, slp and put this line into /etc/cups/client.conf :

```
ServerName 192.168.2.1
```

Then i tried 

```
lpstat -a
```

but i got:

```
lpstat: Unable to connect to server: Connection refused
```

I also check the manual of the router for setting up a printer but the only thing i get is:

----------------------------------------------------------------------------------------------

Congure the Network Printer in Unix Systems

Follow the traditional conguration procedure on Unix platforms to set

up the Barricade print server. The printer name is lpt1.

----------------------------------------------------------------------------------------------

Does anyone know how to setup printer on this router? The manual doesnt say what printing protocol the router use.

Any suggestion are welcome

----------

## morodoch

Are you doing this setup on the router or on the machines trying to print via the router? I don't have anything uncommented in my client.conf file; all of my config is in the printers.conf file. I used the http interface to configure the printers, point your browser at

http://router.yourdomain:631/

You may need to add in your local network address to your cups.conf file, like this:

BrowseAllow 192.168.1.*

BrowseDeny All

Where 192.168.1.* is your local network address.

Once you've updated the cups.conf, restart the cups daemon, then use the url above.

----------

## lnthai2002

Of course i do the setup on my computer in order to print to the printer attached to my router. I dont understand what you said a bout using http interface to config the printer. As far as i know, my router web interface (http://192.168.2.1) does not have any option to config the printer, everything is done automatically. I am connecting to a network without a domain so what do i supposed to open instead of http://router.mydomain:631 in my browser? Can you put your cups config files?

----------

## lnthai2002

I can config my printer from the web browser. In the web configuration of cups, when i click print a test page, the printer worked fine(it print the test page as i expected) but when i use  any application(abiword, gedit, acroread) to print i the printer does not print anything!!! Actually, i can't see(and choose) the printer from any application. All printer i have in gedit are:

```
Create a PDF document

Generic postscript
```

Please help

----------

## morodoch

I guess that the easiest way to get your printer working is to configure cups both on the server [with the printer attached] and the client - the one where you run your apps.

You then tell cups on your client to print using cups on the server.

I guess that you've already got this working on the server, as you can print a test page from there.

Set up the server to allow browsing of printers by adding something like this to your /etc/cups/cupsd.conf file, (note you'll need to make the address entries match your LAN settings):

```
BrowseAddress 192.168.1.255

BrowseAllow 192.168.1.*

BrowseDeny All
```

Once you've added the entries, restart the cups daemon on the server: 

```
/etc/init.d/cupsd restart
```

Set up the client to talk to your server by adding this line to your /etc/cups/cupsd.conf on the client:

```
BrowsePoll server:631
```

Where server is the name (or address?) of your server.

Restart cups on the client: 

```
/etc/init.d/cupsd restart
```

 and your client should be able to see the printer.

You can check this again using your webbrowser, on the client load http://localhost:631, and you should see your printer listed.

----------

## lnthai2002

Thanks for the suggest, man but it still doesnt work. I can not config anything on the server(my router) since it is not a computer, it is just a router. I did, however config cups from my computer(client side). I selected the device as lpd(since it is the only option that i can print the test page). The test page can be printed out but from any application(abiword, acroreader...), i can not see the printer. Below are my /etc/cups/cups.conf that i use 

```
grep -v "#"
```

 to get

```
DocumentRoot /usr/share/cups/docs

LogLevel info

User lp

Group lp

Port 631

BrowsePoll 192.168.2.1:631

SystemGroup lp

<Location />

Order Deny,Allow

Deny From All

Allow From 127.0.0.1

</Location>

<Location /admin>

AuthType Basic

AuthClass System

Order Deny,Allow

Deny From All

Allow From 127.0.0.1

</Location>
```

Any suggestion?

----------

## bombcar

Try emerging nmap and running nmap against your router.

I did that against my Airport Express with USB printer, and found I needed to use:

socket://ipaddressofrouter:9100

----------

## morodoch

Sorry, I thought you meant you were running a linux host as a router with cups on it.

If you can print the cups test page, there's no reason why other apps shouldn't print to it. Have you made your printer the default destination?

----------

## lnthai2002

Yes, I did make it default. When i click on "print a test page" from the web interface config of cups, it work but when i open gedit or any app, i dont see my printer. I only see "print tp pdf" and "Genral postscript". I did try to 

emerge --update --newuse world

but nothing was updated

----------

## morodoch

Generic postscript may be your printer - have you tried it? Linux printing in general tries to make all printers look like postscript.

If you application supports cups directly (as opposed to the lpd subsystem generically), you should see the printer name.

On my machine here, Abiword shows "lpr", where OOo 2 shows "Colour" (the name I've given to the printer in cups).

----------

## lnthai2002

I did try to print through Generic postscript but nothing was printed out. More interesting, when i su and open gedit , i see alot of error like this on the terminal:

```
** (gedit:12482): WARNING **: failed request with status 1280
```

And when i try to print, i see this error on the terminal

```
** (gedit:12392): WARNING **: failed request with status 1280

lpr: error - scheduler not responding!

```

What 's wrong? I never have any error before when i open gedit. I guess since i installed cups, the problem have occured because gedit try to connect to the print server but fail.

Any suggestion?

----------

## morodoch

A bit of googling found this:

http://forums.whirlpool.net.au/forum-replies-archive.cfm/425285.html

 *Quote:*   

> running "export CUPS_SERVER=localhost" before using lpr at the command line now makes it work fine.

 

If this is the case, maybe you need to change your ServerName variable. Could this be firewall related? Do you block incoming / outgoing packets to 192.168.2.1?

----------

## lnthai2002

Well, it work when i use

export CUPS_SERVER=localhost

However, i dont know how to make export run automatically. I dont know anything about firewall, i just installed gentoo a month ago and dont have time to do research on networking on gentoo since my final exams are comming. Can you tell me where should i go to open the port and set ServerName var automatically.

----------

## morodoch

 *Quote:*   

> I have a HP Officejet 725 attached to my router(SMC7004ABR) by parallel port on the router. I followed the instruction here to set up my printer: http://www.gentoo.org/doc/en/printing-howto.xml#setup_remote. I thought i have to use IPP to print so i emerge CUPS with nls, slp and put this line into /etc/cups/client.conf :
> 
> Code:
> 
> ServerName 192.168.2.1

 

I wonder if you should change this address to 127.0.0.1?

----------

## lnthai2002

YES, it work now. But I dont understand why ServerName must be my ip(local host). It should be the ip of the machine to which the printer connect, in my case, it is the router. Can you explain?

----------

## morodoch

I think what's going on is that you have two print servers:-

1. the router has a printer attached and makes it available to the network using the lpd protocol

2. your local system has a cups server, which makes a "virtual" postscript printer available to your local clients - it takes the postscript you print to its queue, formats it for your printer, and forwards it to your router

So really the print job probably does something like this:

1. application sends postscript to local cups queue

2. cups pulls the request from its queue, formats it according to your printer model, and sends it to an lpd queue on your router

3. your router pulls from its own queue and sends it out the printer port

----------

## lnthai2002

Well, so basicly, I have to use cups server because the router doesnt have software print server to convert data into printable format. It just makes the printer available on the network through lpd protocol. If that is the case, it doesnt matter what protocol i choose(lpd or ipp or smb), i still need cups server running locally on each client to print UNLESS i attached the printer to another linux computer and installed cups on that comp, right?

BTW, when i config my printer through the web interface, i see 

```
Duplexer:      Installed       Not Installed
```

and 

```
Double-Sided Printing
```

What are they? As i see, my printer can not print double side automatically because it does not have any mechanism to reload a page and print on the other side. So i guess i cant use double side but how about the other?

Thanks for helping me

----------

## lnthai2002

One more thing, my printer is Office Jet 752 but cups only has deskjet driver. This deiver however has some probem with the paper size. It does not have the paper size i use (letter 21.6*27.9) and does not have a custom paper size, so there is no way i can modify the paper size to fit my need. How can i use the other driver that has my paper size, if it is not possible, how can i modify the paper size?

----------

## morodoch

You don't *have* to use cups, but cups *will* allow you to print fonts, graphics and such by providing a generic postscript interface to your printer. Check out "printcap" and the old lpd system if you really want to not run cups. I think cups provides a better and easier to set up system.

As far as your printer model is concerned, I suggest installing foomatic and foomatic-db with the cups & ppds USE flags set - this should give you additional models to select from. Alternatively you can use this page to generate a ppd file for your printer:

http://www.linuxprinting.org/printer_list.cgi

I think emerging the foomatic packages is probably going to be easier though.

I think you need to restart cupsd after you've installed the foomatic stuff to see the additional printer types, but I'm not sure.

----------

## lnthai2002

I did download the ppd file and put it in the correct location. I restart cups and the web interface of cups detect the driver(ppd file) but when i choose that driver and try to print from any application, the printer just print out a blank page(it just eject the paper, nothing is printed). I guess there is no way to use cups without foomantic!!!

Please let me know if you have succeded setting up the printer with only ppd files

Thai

----------

