HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Best way to print faxes





Hello,


On Wed, Jun 21, 2000 at 10:45:36AM -0700, Tim Rice wrote:
> On Wed, 21 Jun 2000, Mark Lehrer wrote:
> > What is the secret option here?  Obviously, hacking the source to
> > viewfax is looking like my only choice... hopefully there is a better
> > way.
> If you have a postscript printer just use fax2ps.

I sort of do ok with the script hammered together below. It fetches a
fax from the server, converts and displays it with gv, and then I print
from there if I want. I have lprng+magicfilter installed, though. With
vanilla BSD lpr I was not so lucky... on a simple LJ4.

Use as in "getfax 213" for fax # 213. I get that number from the mail
hylafax sends me upon receiving a fax.


Best Regards,
--Toni++

---- snip -----
#!/usr/bin/perl -w
my $DRUCK="no";
my $Opts = "-H11.4 -W8.7";
my $WorkDir = "PS";
use Getopt::Std;
use vars qw/ $opt_r /;
getopt ('r');
my $FAX=shift;
$Opts = "" if $opt_r;
$FAX = $opt_r if not $FAX;
delete $ENV{'ftp_proxy'};
chdir "/usr/tmp";
mkdir $WorkDir, 01770 if not -d $WorkDir;
$FaxURL = "ftp://YourFaxServer:4559/recvq/fax";
$Job = $FAX;
if ($FAX =~ /^\d+$/) {
        $Num = sprintf "%05d", $FAX;
        $Job = "$FaxURL$Num.tif";
}
system "wget -nc --passive-ftp $Job";
die "$0: problem accessing $Job\n" if not -f "/usr/tmp/fax$Num.tif";
$Job =~ s/^.*fax/fax/;
chmod 0660, $Job;
system "chgrp staff $Job";
$FN = $Job;
$FN =~ s/0+//;
$FN =~ s/.tif.*/.ps/;
system "fax2ps $Opts $Job > $WorkDir/$FN";
system "chgrp staff $WorkDir/$FN";
print "view fax? ";
$Ans = <STDIN>;
system "gv", "-media", "a4", "$WorkDir/$FN" if $Ans =~ /^[^nN]/;
exit 0 unless $DRUCK eq "yes";	### remove this if you want to print
				### non-interactively (w/o using gv)
print "print fax? ";
$Ans = <STDIN>;
if ($Ans =~ /^[jJyY]/) {
        open (FN, "/home/staff/bin/print -v $WorkDir/$FN|")
                or die "$0: Cant fork job: $!\n";
}

exit 0;

---- snip -----




____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions