Annotation of loncom/interface/printout.pl, revision 1.7

1.1       sakharuk    1: #!/usr/bin/perl
1.6       sakharuk    2: use IO::File;
1.7     ! sakharuk    3: use Image::Magick;
1.1       sakharuk    4: print "Content-type: text/html\n\n";
                      5: print "<body bgcolor=\"#FFFFFF\">\n";
1.7     ! sakharuk    6: print "<h1>OUTPUT is in the PDF FILE (see link below)</h1>\n";
        !             7: my ($texfile,$laystyle) = split(/&/,$ENV{'QUERY_STRING'});
        !             8: my $figfile = $texfile;
        !             9: $figfile =~ s/\.tex/\.dat/;
        !            10: if (-e $figfile) {
        !            11:     my $temporary_file=IO::File->new($figfile) || die "Couldn't open file for reading: $!\n";
1.6       sakharuk   12:     my @content_of_file = <$temporary_file>;
1.7     ! sakharuk   13:     close $temporary_file;  
        !            14:     my $noteps;
        !            15:     foreach $not_eps (@content_of_file) {
        !            16: 	if ($not_eps ne '') {
        !            17: 	    my $eps_f = $not_eps;
        !            18: 	    $eps_f =~ s/\..*$/\.eps/;
        !            19: 	    $_ = $eps_f;
        !            20: 	    m/\/(\w+\.eps)/;
        !            21: 	    $eps_f = '/home/httpd/prtspool/'.$1;
        !            22: 	    my $image = Image::Magick->new;
        !            23: 	    $not_eps =~ s/^\s+//;
        !            24: 	    $not_eps =~ s/\s+$//;
        !            25: 	    $status = $image->Read($not_eps);
        !            26: 	    if ($status) {print "  $status  ";}
        !            27: 	    $image->Set(page => '+100+200'); 
        !            28: 	    $status = $image->Write($eps_f);	    
        !            29: 	    if ($status) {print "  $status  ";}
        !            30: 	}
1.6       sakharuk   31:     }
1.7     ! sakharuk   32:     unlink $figfile;
1.6       sakharuk   33: }
1.4       sakharuk   34: print "$texfile\n";
1.1       sakharuk   35:  $_ = $texfile;
                     36:  m/^(.*)\/([^\/]+)$/; 
                     37: my $name_file = $2;
                     38: my $path_file = $1.'/';
                     39:  chdir $path_file;
                     40:  system("latex $name_file 1>/dev/null 2>/dev/null");
                     41:  $name_file =~ s/\.tex/\.dvi/;
                     42: my $new_name_file = $name_file;
                     43:  $new_name_file =~ s/\.dvi/\.ps/;
1.2       sakharuk   44: my $comma = "dvips -o $new_name_file";
                     45:  system("$comma $name_file");
                     46:  $_ = $new_name_file;
                     47:  m/^(.*)\./;
                     48: my $tempo_file = $1.'temporar.ps';
                     49: my $name_file = $1.'.pdf';
1.4       sakharuk   50: if ($laystyle eq 'album') {
                     51:     $comma = "psnup -2 -s1.0 $new_name_file";
                     52:     system("$comma $tempo_file"); 
                     53:     system("ps2pdf $tempo_file $name_file");
                     54: } elsif ($laystyle eq 'book') {
                     55:     system("ps2pdf $new_name_file $name_file");
1.7     ! sakharuk   56: }	    
        !            57: my $texlog = $texfile;
        !            58: my $texaux = $texfile;
        !            59: my $texdvi = $texfile;
        !            60: my $texps = $texfile;
        !            61: $texlog =~ s/\.tex/\.log/;
        !            62: $texaux =~ s/\.tex/\.aux/;
        !            63: $texdvi =~ s/\.tex/\.dvi/;
        !            64: $texps =~ s/\.tex/\.ps/;
        !            65: my @garb = ($texlog,$texaux,$texdvi,$texps);
        !            66: unlink @garb;
1.1       sakharuk   67: 
                     68: 
1.3       albertel   69: print "<a href=\"/prtspool/$name_file\">Your PDF document</a>\n";
1.1       sakharuk   70: print "\n";
                     71: 
                     72: 
                     73: 
                     74: 
1.4       sakharuk   75: 

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