File:  [LON-CAPA] / loncom / interface / printout.pl
Revision 1.5: download - view: text, annotated - select for diffs
Wed Apr 10 16:23:24 2002 UTC (22 years, 1 month ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
very very first attempt to work with eps production - experiment

    1: #!/usr/bin/perl
    2:     use Image::Magick;
    3: print "Content-type: text/html\n\n";
    4: print "<body bgcolor=\"#FFFFFF\">\n";
    5: print "<h1>OUTPUT is in the PDF FILE below</h1>\n";
    6: my ($texfile,$laystyle,$notepslist) = split(/&/,$ENV{'QUERY_STRING'});
    7: 
    8: #if ($notepslist ne '') {
    9: #    my $image = Image::Magick->new;
   10:     my $newnotepslist = $notepslist;
   11:     $newnotepslist =~ s/\.eps/\.gif/;
   12: #    $image->Read("gif:$newnotepslist");
   13: #    $image->Set(page => '+100+200');
   14:     $_ = $notepslist;
   15:     m/\/(\w+\.eps)/;
   16:     $notepslist = $1;
   17: #    $image->Write("eps:$notepslist");
   18: #    open(EPS,$notepslist) or die "Couldn't open the EPS file: $!";
   19: #    undef $/;
   20: #    my $eps = <EPS>;
   21: #    close EPS;
   22:     $notepslist = '/home/httpd/prtspool/'.$1;
   23: #    open(OUT,'>'.$notepslist) or die "Couldn't open the output EPS file: $!";
   24: #    print OUT <<EndPrint;
   25: #/Times-Roman findfont 48 scalefont setfont
   26: #100 150 moveto
   27: #(This is an EPS graphic) show
   28: #EndPrint
   29: #print OUT $notepslist;
   30: #print OUT "showpage\n";
   31: #close OUT;
   32:     print"  aaa: $newnotepslist\n";
   33:     print"  bbb: $notepslist\n   CCC: ";
   34:     system("convert gif:$newnotepslist eps:$notepslist" );
   35: #}
   36: print "$texfile\n";
   37:  $_ = $texfile;
   38:  m/^(.*)\/([^\/]+)$/; 
   39: my $name_file = $2;
   40: my $path_file = $1.'/';
   41:  chdir $path_file;
   42:  system("latex $name_file 1>/dev/null 2>/dev/null");
   43:  $name_file =~ s/\.tex/\.dvi/;
   44: my $new_name_file = $name_file;
   45:  $new_name_file =~ s/\.dvi/\.ps/;
   46: my $comma = "dvips -o $new_name_file";
   47:  system("$comma $name_file");
   48:  $_ = $new_name_file;
   49:  m/^(.*)\./;
   50: my $tempo_file = $1.'temporar.ps';
   51: my $name_file = $1.'.pdf';
   52: if ($laystyle eq 'album') {
   53:     $comma = "psnup -2 -s1.0 $new_name_file";
   54:     system("$comma $tempo_file"); 
   55:     system("ps2pdf $tempo_file $name_file");
   56: } elsif ($laystyle eq 'book') {
   57:     system("ps2pdf $new_name_file $name_file");
   58: }
   59: 
   60: 
   61: 
   62: 
   63: print "<a href=\"/prtspool/$name_file\">Your PDF document</a>\n";
   64: print "\n";
   65: 
   66: 
   67: 
   68: 
   69: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>