Skip to Content.
Sympa Menu

baslinux - Re: [BL] double sided printing script

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] double sided printing script
  • Date: Thu, 23 Mar 2006 20:26:26 +0000 (UTC)

(From David Moberg)

(Sindi's) Scripts to print even or odd pages only:

printeven:

#!/bin/sh
for i in *[0,2,4,6,8].pbm; do pbmtolj $i > /dev/lp0; done

Turn over and reinsert stack of paper, if needed reverse order of pages.

printodd:

I read this as 'print to dd'. Might want to put an underscore in there.

Okay, or oddprint.

Can I specify 'odd number' instead of writing them all out?

No, that's not a supported character list, even in bash.

I meant is there some way to specify that I only want odd characters.
I have not studied script writing, just trying to model something on what you and Steven have already produced, by trial and error.


I tested with 'echo' instead of pbmtolj and got 01 03 11 33 (ascending).
I got the same output with [9,7,5,3,1]. How do I specify descending
numerical order in a script?

Why not nest the loop inside of another one?
##U
#!/bin/sh
for x in `seq 9 -2 1`
do
for i in *$x.pbm; do pbmtolj $i > /dev/lp0; done
done

Will this print 19 17 15..... 9 7 5 3 1 ? I will test. I made a script with two variants of this line for even numbers (turns out the files got numbered 1-16), to use with printers that output the sheets printed sides up or down, in the stack. I don't know what I have because at present mine is shedding its output onto the floor and I need to make a catcher. (It curls the paper if you set it to feed upwards instead of outwards).

(`seq 9 -2 1` is the same as 9 7 5 3 1
`seq 1 2 9` is the same as 1 3 5 7 9)

from 1 to 9, by steps of 2. I think I ran across seq in 'shell scripting 101' on the web, under 'sort'.

Next problem. The idiot who scanned the sheet music scanned it in color (though it is black on white) and probably to make a somewhat smaller file scanned at 150 dpi. pdftoppm partita5.pdf > par5 (root of the output file) gave me par5-000001.ppm through par5-000016.ppm, each a color file over 6MB (8-bit color). A 300 dpi file not in color is about 1MB.

I used ppmtopgm then pgmtopbm to produce 250K pbm files, which view much faster with zgv and print quickly (-res 150 gets them the right size). The color files won't print on my laser printer (they produce a mostly black page of garbage) and I don't want to print them in color on the inkjet printer (which would be much slower and maybe waste colored ink). The conversion takes a few seconds for the batch of files, using a script.

I called the script 'bleach'.

for i in *.ppm; do ppmtopgm $i | pgmtopbm | pamcut -75 top > $i.pbm; done

The bottom few notes were cut off on all the pages. I used pamcut -top 75 to chop 1/2" (75 pixels, at 150 resolution) off the top of the page so that the bottom printed on the paper.

Bleach produced par5-00001.ppm.pbm.
Is there a simple way to remove the ppm from the file name by adding something to the above script? It prints even with this long name.

pbmtolj -res 150 par5-000001.ppm.pbm > /dev/lp0

The conversion from low-res color to grey to black makes it somewhat worse looking. Partita 4 printed directly from gs (as a pdf file) using a driver for a mono laser printer, not quite as fuzzy looking, but I don't know an easy way (without gv - did you compile it yourself, Ron?) to print double-sided that way, and the bottoms of the pages were all chopped off and I don't know how to fix that with gs (I used a black pen) and it is very easy with netpbm.

I wonder whether the people who scanned this managed to print it properly. Perhaps they have European sized paper.

I will report back if David's script does not work. Thanks to all for the help. Some day I may post a midi file of the results. Do I need to record each voice of a 3-part fugue separately with Rosegarden?

Sindi




Archive powered by MHonArc 2.6.24.

Top of Page