--- loncom/interface/printout.pl 2006/04/24 21:30:06 1.98 +++ loncom/interface/printout.pl 2006/06/06 11:04:18 1.99 @@ -475,6 +475,7 @@ foreach $texfile (@texfile) { "for $status_statement now Converting to PS", \%prog_state,$new_name_file); if (-e $new_name_file) { + &repaginate_postscript($new_name_file); print "

PDF output file (see link below)

\n"; $new_name_file =~ m/^(.*)\./; my $ps_file = my $tempo_file = $1.'temporar.ps'; @@ -549,6 +550,7 @@ foreach $texfile (@texfile) { "for $status_statement now Converting to PS", \%prog_state,$new_name_file); if (-e $new_name_file) { + &repaginate_postscript($new_name_file); print "
"; $new_name_file =~ m/^(.*)\./; my $ps_file = my $tempo_file = $1.'temporar.ps'; @@ -659,5 +661,27 @@ 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 = ; + close(PSFILE); + my $psbody = join('', @psfilelines); + $psbody =~ s/STARTOFSTUDENTSTAMP//g; + $psbody =~ s/ENDOFSTUDENTSTAMP//g; + open(PSFILE, ">$postscript_filename"); + print PSFILE $psbody; + + close PSFILE; +}