Skip to Content.
Sympa Menu

baslinux - Re: [BL] help with a printing script?

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: baslinux AT lists.ibiblio.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] help with a printing script?
  • Date: Tue, 25 Mar 2008 20:51:34 +0000 (UTC)

On Tue, 25 Mar 2008, baslinux AT lists.ibiblio.org wrote:

I'd like to create a script for printing from my new BL laptop. Sindi has
a script at her site which is close to what I need, but not quite. The
reason her script won't work so well for me is because I don't always have
a parallel port connected to this laptop: the laptop has one of those "i/o
bars" that has to be hooked to the machine and that has the parallel port
on it, and it will not always be hooked up. It will obviously be no good
to go insmod'ing modules for a non-existent parallel port. So I'd like to
add to her script some routine for checking whether the parallel port
modules have already been inserted--like by using the output of lsmod. If

Why not just insert them in the script anyway, whether or not they are already inserted?

they have not been inserted, the script should ask whether to insert them
and then do so or abort, accordingly. Finally, her script seems to need to
run with a filename specified. Instead of that, I'd like to just have a
terminal output the command (e.g., using echo) that one should enter into
the terminal in order to print. Something like "To print a file on this
machine, enter the command gs -sOutputFile=/dev/lp0 /path/to/file". Can
anyone offer me some help on this? See below for Sindi's script.

I would not want to be typing this every time to print, which is why I made a script.


--------begin Sindi's printing script------------------------
#!/bin/sh
insmod parport
insmod parport_pc
insmod lp

These insert the modules every time whether or not they are already inserted. It might waste a second or so and give you a message they are already inserted.


#/var/spool/lpd/postscript/deskjet.filter < $1 > /dev/lp0
#gs -q -dSAFER -sDEVICE=deskjet -r300x300 -sPAPERSIZE=letter
-sOutputFile=- - -dFirstP

You don't need the lines above, just the one below. They are two previous scripts that I just left for my own edification, one using lpr, one an attempt to make a script that printed a selection of pages (and it is not even complete - -dFirstPage=1 -dLastpage=2 if you were printing pages 1 and 2). Delete these three lines. I should fix what I posted. (I post often because I keep losing hard drives locally).


gs -r300 -sOutputFile=/dev/lp0 $1

This line only works if deskjet is the default device.
Otherwise you will need -sDEVICE=cdeskjet (or some other device).
The -r300 is I think default for the deskjet and could be omitted.
Read the Use.htm for gs.

Therefore my script should read:
insmod parport
insmod parport_pc
insmod lp
gs -sOutputFile=/dev/lp0 $1

You can probably add switches for multiple copies. Set up additional scripts for different resolutions.

---------end Sindi's printing script---------------------------

Thanks,
James





Archive powered by MHonArc 2.6.24.

Top of Page