Really effective legal-size document copying script

From: Thomas Boutell (boutell@vader.boutell.com)
Date: Thu Mar 22 2001 - 15:10:11 PST

  • Next message: John Coppens: "Re: xscanimage as gimp plug-in"

    My apologies if this sort of thing is inappropriate for
    sane-devel, but there doesn't seem to be a user-oriented
    sane mailing list, and since this is a utility script
    based on scanimage, it's sort of in the middle.

    Some of you may remember my 'sanecgi' web-based wrapper
    around the scanimage utility. That's still around and it
    still works; we still use it here and haven't felt any
    great need to upgrade to saned/win32 xsane/etc so far.

    You can find that here: http://www.boutell.com/sanecgi/

    However, one fairly common task in our office that is not
    convenient with that tool is producing a readable
    copy of a legal-size document on our regular-size fax/printer.
    We have a legal-size scanner hooked up; surely sane can help!

    The following Perl script, 'copylegal', does a
    bang-up job copying any legal-size document that consists primarily
    of text and line art, such as a contract (which is exactly
    what people get stuck with on legal size paper). I have used
    this successfully for important legal documents. I hope others
    will find it useful also. You'll want to modify the
    '$scanimage =' line to match your system; the rest is OK if you
    have the netpbm utilities and ghostscript or a Postscript printer.

    Tuning this script "just so" took longer (and killed more trees)
    than you might imagine.

    * * * Cut Here * * *

    $scanimage = "/usr/local/bin/scanimage -d microtek:/dev/sgi";

    #!/usr/local/bin/perl

    print "This script is noisy; it prints stuff. That's OK.\n";
    print "Also, this script finishes about a minute or so before\n";
    print "anything actually comes out of the printer. That's OK too.\n\n";

    $dpi = 300;
    $ol = 0;
    $ot = 0;
    $ox = 25.4 * 8.5;
    $oy = 25.4 * 14;
    $scaledW = 8.0 * $dpi;
    $scaledH = 10.5 * $dpi;

    system("$scanimage -v --mode Gray -l $ol -t $ot -x $ox -y $oy " .
            "--resolution 150 -d microtek:/dev/sgi " .
            "| pnmscale -xysize $scaledW $scaledH " .
            "| pgmtopbm -threshold | pnmtops | lpr");

    * * * Cut Here * * *

    --
    Thomas Boutell
    Boutell.Com, Inc.                                       
    http://www.boutell.com/
    

    -- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com



    This archive was generated by hypermail 2b29 : Wed Mar 28 2001 - 12:32:50 PST