First set up a printer entry:
STARTSHP <ptr#>,<ptr#>,0,S<port>,LP.UNIX,(/usr/local/bin/print_to_pdf)
The print_to_pdf script looks like this:
----
/usr/local/bin/enscript -e -Z -B --non-printable-format=questionmark -h -H
--font=Courier-Bold7.5 --ps-level=1 --media=Letter > /tmp/print_pdf.ps
/usr/bin/ps2pdf /tmp/print_pdf.ps /tmp/print_pdf.pdf
/usr/local/bin/mail_pdf <user>@<domain> /tmp/print_pdf.pdf Printed_PDF_Report
----
You'll need to grab enscript & ps2pdf to create the PDF output - both are
open source packages.
The mail_pdf is a perl script:
----
#!/usr/bin/perl -w
use strict;
use MIME::Lite;
use Getopt::Std;
#------------------------------
# main
#------------------------------
sub main {
my %opts;
### Get options:
getopts('', \%opts) or die "usage error\n";
my $addr = $ARGV[0] || die "Missing email address.\n";
my $fpath = $ARGV[1] || die "Missing filename to attach.\n";
my $subj = $ARGV[2] || die "Missing Subject.\n";
my $msg = MIME::Lite->new(From => '<user>@<domain>',
To => $addr,
Subject => $subj,
Type => "multipart/mixed");
$msg->attach(Type => "application/pdf",
Path => $fpath,
Disposition => "attachment");
MIME::Lite->send("smtp","<outgoing mail server addr>", Timeout=>60);
$msg->send;
}
exit(&main ? 0 : -1);
1;
__END__
----
The perl script requires that you have the MIME::Lite package installed
(this can be done via CPAN).
This will allow you to send PDF files to a single user.
Two questions - is it possible to pass a parameter through STARTSHP (say
the user name) in order to allow specifying the destination address? I
haven't found anything in the docs that mentions this. (I don't want to
make mods to STARTSHP itself if it can be avoided)
My second question, is it possible to make the system NOT kick a page
before starting the print job? All my PDF files start with a blank page.
:)
Thanks all - hopefully some of you might find this useful. :)
g.
--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby. Geeks collect hobbies.
ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://www.scarletdme.org - Get it _today_!
Political correctness is a doctrine, fostered by a delusional, illogical
minority, and rabidly promoted by an unscrupulous mainstream media, which
holds forth the proposition that it is entirely possible to pick up a turd
by the clean end.