Solved

Linux General question

Posted on 1997-09-11
2
293 Views
Last Modified: 2013-12-03
I have been trying for a while to get my canon bjc-240 to work under Linux.
 I have read the printing-HOWTO, but still have a few questions...

I am able to cat text to the printer, but I get a staircase effect.  I
understand that I need to set up filters in lpd to take care of this...
What is the easiest way to go about this?

When I do lpr filename, I get the message: connection to lp@myhostname
failed - connection refused.

What am I doing wrong?  If anyone has the same printer, your lpd.conf and
printcap would be extremely helpful.

Thanks a lot!
0
Comment
Question by:justj
2 Comments
 
LVL 2

Accepted Solution

by:
jeffa072897 earned 0 total points
ID: 1626683

Here is what I use for a local attached printer.

This is a script file called "print" in /usr/bin which is chmod 755

cat $1|/usr/bin/lpfilter|/usr/bin/lpr -Phpj

This is a staircase filter that I found in the origional Linux Bible boot. The file is caled lpfilter and lives in /usr/bin.

#!/bin/sh
if [ "$1" = -c ]; then
  cat
else
/ sed -e s/$/
fi
# the ''echo -ne'' assumes that /bin/sh is really bash
echo -ne \\f

Lastly here is my printcap file -

# Generic printer:
#lp:lp=/dev/lp1:sd=/usr/spool/lp1:sh
#lp|genicom|local:lp=/dev/lp1:if=/usr/lib/lpd/lpf:sd=/usr/spool/lp1:sh:
lp|genicom:if=/usr/bin/lpfilter::rp=raw:\
        :rm=BEDFORD_POLOCK_PRT:sd=/usr/spool/lp1:sh:
#
# HP Laser jet plus
hpj|lp2:\
        :lp=:rm=dprint:\
        :sd=/usr/spool/lp2:

One important note. If your printer is networked then you must pipe through the filter before giving the data to lpr. The lpd daemon that comes with Linux dosent support filters to network filters. Here's an example of what I mean -

Take a file and put in the following -
cat $1|/usr/bin/lpfilter|/usr/bin/lpr -Plp
chmod the file 755 and call it as file <file to print>



0
 

Author Comment

by:justj
ID: 1626684
I still get 'connection refused'.  Checked /etc/lpd.perms, everything looks fine...  Thanks for the answer, Jeff.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now