<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use File::stat;

##############################################################################
# Please change the following values to ones that are appropriate for your
# environment.
##############################################################################

# Set path:
$ENV{'PATH'} = "/bin:/usr/bin:".$ENV{'PATH'};

# Set temp directory:
$tmpdir = "/tmp";

# Set pickup directory:
$pickupdir = "/usr/public/pickup";
 
# Set mail server:
#$mailhost = "mail.phys.virginia.edu";

# Set ps filter:
#$psfilter = "/usr/lib/magicfilter/psonly300-filter";

# Set metamail mailer:
#$metamail_mailer = "/usr/bin/mailto";

# Set berkeley mailer:
#$berkeley_mailer = "/bin/mail";

# Set pickup host:
#$pickup_url = "http://print.phys.virginia.edu/pickup";

# Set max file size to mail (bytes):
$max_mail_size = 1440000;

# Set file expiration warning, for large files:
$expire_warning = "The file will be available for 2 hours.";

##############################################################################
# No Changes should be necessary below this line.
##############################################################################

# Parse arguments:
while ( $i = shift ARGV) {
  ARGSPEC: for ($i) {
      /^-/ &amp;&amp; do {
	  
	  $flag  = $i;
	  $flag  =~ /^-(.).*$/;
	  $flag  = $1;
	  
	  $value = $i;
	  $value =~ /^-.(.*)$/;
	  $value = $1;

	SWITCH: for ($flag) {
	    /n/ &amp;&amp; do {
		$User = $value;
		last SWITCH;
	    };
	    /h/ &amp;&amp; do {
		$Host = $value;
		last SWITCH;
	    };
	    /e/ &amp;&amp; do {
		$File = $value;
		last SWITCH;
	    };
	}
	  
	  last ARGSPEC;
      };

      $AcctFile = "$i";

  }
}

# Check to make sure it's postscript. Convert it to PS if not:
#open ( PSFILTER, "|$psfilter &gt; $tmpdir/$$.pdfmail.ps" );
#while ( &lt;&gt; ) {
#    print PSFILTER "$_";
#}
#close ( PSFILTER );

# Convert postscript to pdf:
#system ( "ps2pdf -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true $tmpdir/$$.pdfmail.ps $tmpdir/$$.pdfmail.pdf" );
system ( "ps2pdf13 $tmpdir/$$.ps $tmpdir/$$.pdf" );

# Get size of pdf file:
#$size = stat( "$tmpdir/$$.pdfmail.pdf" )-&gt;size;

# Compute checksum:
#$checksum = (split(/\s+/,`md5sum $tmpdir/$$.pdfmail.pdf`))[0];

# If the file is small, mail it as an attachment. 
# Otherwise, send the user a link to a pickup area:
#if ( $size &lt; $max_mail_size ) {

# Mail pdf file to recipient:
#`$metamail_mailer -s "PDF mail from $User at $Host" $User\@$mailhost &lt;&lt;EOF
#The following attachment has been sent to you via a PS --&gt; PDF converter.
#(size $size bytes)
#~/50000000
#~*
#1
#$tmpdir/$$.pdfmail.pdf
#application/pdf ; name="pdfmail.pdf"
#y
#				Thank you.
#EOF`;
#
#unlink ( "$tmpdir/$$.pdfmail.pdf" );
#
#} else {
#
# Put PDF into pickup dir:
#rename ( "$tmpdir/$$.pdf", "$pickupdir/$$.pdf" );

# Write html wrapper:
#open ( HTMLFILE, "&gt;$pickupdir/$checksum.html" );
#print HTMLFILE "&lt;html&gt;&lt;head&gt;&lt;title&gt;Converted PDF file&lt;/title&gt;&lt;/head&gt;&lt;body bgcolor=white&gt;\n";
#print HTMLFILE "&lt;h1&gt;Converted PDF File&lt;/h1&gt;\n";
#print HTMLFILE "Your file is available here: &lt;a href=$checksum.pdf&gt;&lt;img alt=\"Click to Download\" src=/icons/pdf.gif&gt;&lt;/a&gt;\n"; 
#($size bytes)\n";
#print HTMLFILE "&lt;br&gt;&lt;b&gt;Note:&lt;/b&gt; In some browsers you may need to press the shift key while clicking";
#print HTMLFILE "on the icon in order to download the file.\n";
#print HTMLFILE "&lt;hr&gt;&lt;i&gt;$expire_warning&lt;/i&gt;\n";
#print HTMLFILE "&lt;/body&gt;&lt;/html&gt;\n";
#close ( HTMLFILE );

# Make files readable:
#chmod ( 0744, "$pickupdir/$checksum.html" );
#chmod ( 0744, "$pickupdir/$$.pdf" );

# Mail pdf file to recipient:
#`$berkeley_mailer -s "PDF mail from $User at $Host" $User\@$mailhost &lt;&lt;EOF
#The following message has been sent to you by a PS --&gt; PDF converter.
#Your PDF document can be picked up at the following Web address:
#
# $pickup_url/$checksum.html
#
#$expire_warning
#(File size is $size bytes)
#EOF`;

unlink ( "$tmpdir/$$.pdf" );

#}

unlink ( "$tmpdir/$$.ps" );

print "done\n";
exit;




</pre></body></html>