Diff for /loncom/interface/printout.pl between versions 1.97 and 1.99

version 1.97, 2006/04/20 02:24:08 version 1.99, 2006/06/06 11:04:18
Line 238  print "<a href=\"$backref\"><b>Return</b Line 238  print "<a href=\"$backref\"><b>Return</b
       $done_conversion{$not_eps}=1;        $done_conversion{$not_eps}=1;
       # print "Converting $not_eps -> $eps_f"; # Debugging        # print "Converting $not_eps -> $eps_f"; # Debugging
       system("convert $not_eps $eps_f");        system("convert $not_eps $eps_f");
               #check is eps exist in prtspool                # check is eps exist in prtspool
               if(not -e $eps_f) {                if (not -e $eps_f) {
     # converting an animated gif creates either:
                     # anim.gif.eps.0
                     # or
                     # anim.gif-0.eps
   for (my $i=0;$i<10000;$i++) {    for (my $i=0;$i<10000;$i++) {
       if (-e $eps_f.'.'.$i) {        if (-e $eps_f.'.'.$i) {
   rename $eps_f.'.'.$i, $eps_f;    rename($eps_f.'.'.$i, $eps_f);
   last;    last;
       }        }
         my $anim_eps = $eps_f;
         $anim_eps =~ s/(\.[^.]*)\.eps$/$1-$i\.eps/i;
         if (-e $anim_eps) {
     rename($anim_eps, $eps_f);
     last;
         }
     }
         }
         # imagemagick 6.2.0-6.2.7 fails to properly handle
                 # convert anim.gif anim.gif.eps
                 # it creates anim.eps instead. 
                 if (not -e $eps_f) {
     my $eps_f2 = $eps_f;
     $eps_f2 =~ s/\.[^.]*\.eps$/\.eps/i;
     if(-e $eps_f2) {
         rename($eps_f2,$eps_f);
   }    }
       }          }
   
   }    }
       }        }
       if ($advanced_role) {         if ($advanced_role) { 
Line 454  foreach $texfile (@texfile) { Line 475  foreach $texfile (@texfile) {
      "for $status_statement now Converting to PS",       "for $status_statement now Converting to PS",
      \%prog_state,$new_name_file);       \%prog_state,$new_name_file);
   if (-e $new_name_file) {    if (-e $new_name_file) {
         &repaginate_postscript($new_name_file);
       print "<h1>PDF output file (see link below)</h1>\n";        print "<h1>PDF output file (see link below)</h1>\n";
       $new_name_file =~ m/^(.*)\./;        $new_name_file =~ m/^(.*)\./;
       my $ps_file = my $tempo_file = $1.'temporar.ps';        my $ps_file = my $tempo_file = $1.'temporar.ps';
Line 528  foreach $texfile (@texfile) { Line 550  foreach $texfile (@texfile) {
      "for $status_statement now Converting to PS",       "for $status_statement now Converting to PS",
      \%prog_state,$new_name_file);       \%prog_state,$new_name_file);
   if (-e $new_name_file) {    if (-e $new_name_file) {
         &repaginate_postscript($new_name_file);
       print "<br />";        print "<br />";
       $new_name_file =~ m/^(.*)\./;        $new_name_file =~ m/^(.*)\./;
       my $ps_file = my $tempo_file = $1.'temporar.ps';        my $ps_file = my $tempo_file = $1.'temporar.ps';
Line 638  sub busy_wait_command { Line 661  sub busy_wait_command {
 }  }
   
   
   #  Repagninate a postscript file.
   #  What we need to do:
   #   - Count the number of pages in each student.
   #   - Add pages between each student so that each student's output is
   #     the maximum number of pages.
   #   
   sub repaginate_postscript {
       # For now just strip out the STARTOFSTUDENTSTAMP
       # ENDOFSTUDENTSTAMP markers in the postscript.
   
       my ($postscript_filename) = @_;
       open(PSFILE, "<$postscript_filename");
       my @psfilelines = <PSFILE>;
       close(PSFILE);
       my $psbody = join('', @psfilelines);
       $psbody =~ s/STARTOFSTUDENTSTAMP//g;
       $psbody =~ s/ENDOFSTUDENTSTAMP//g;
   
       open(PSFILE, ">$postscript_filename");
       print PSFILE $psbody;
   
       close PSFILE;
   }
   

Removed from v.1.97  
changed lines
  Added in v.1.99


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