Diff for /loncom/interface/printout.pl between versions 1.100 and 1.101

version 1.100, 2006/06/12 11:21:07 version 1.101, 2006/06/12 18:05:02
Line 161  END Line 161  END
 }  }
  &Apache::lonlocal::get_language_handle();   &Apache::lonlocal::get_language_handle();
  &Apache::loncommon::content_type(undef,'text/html');   &Apache::loncommon::content_type(undef,'text/html');
  print(&Apache::loncommon::start_page('Creating PDF'));  
     print(&Apache::loncommon::start_page('Creating PDF'));
   
   my $identifier = $ENV{'QUERY_STRING'};    my $identifier = $ENV{'QUERY_STRING'};
   my $texfile = $env{'cgi.'.$identifier.'.file'};    my $texfile = $env{'cgi.'.$identifier.'.file'};
Line 640  sub busy_wait_command { Line 641  sub busy_wait_command {
           
     $SIG{CHLD} = \&REAPER;      $SIG{CHLD} = \&REAPER;
     $done=0;      $done=0;
       print("<p> Doing : <tt>$command</tt>");
     my $pid=open(CMD,"$command |");      my $pid=open(CMD,"$command |");
     if ($advanced_role) {      if ($advanced_role) {
  &Apache::lonhtmlcommon::Update_PrgWin('',$progress_win,$message);   &Apache::lonhtmlcommon::Update_PrgWin('',$progress_win,$message);
Line 659  sub busy_wait_command { Line 661  sub busy_wait_command {
     $SIG{CHLD}='IGNORE';      $SIG{CHLD}='IGNORE';
     close(CMD);      close(CMD);
 }  }
       print("<p> End</p>");
   
 #  Repagninate a postscript file.  #  Repagninate a postscript file.
 #  What we need to do:  #  What we need to do:
Line 693  sub repaginate_postscript { Line 695  sub repaginate_postscript {
   
  # Check for total pages (%%Pages:)   # Check for total pages (%%Pages:)
   
  if (($line =~ "^%%Pages:") && (!$seen_pages)) {   if (($line =~ /^%%Pages:/) && (!$seen_pages)) {
     my @pageinfo = split(/ /,$line);      my @pageinfo = split(/ /,$line);
     $total_pages = $pageinfo[1];      $total_pages = $pageinfo[1];
     $seen_pages  = 1;      $seen_pages  = 1;
Line 704  sub repaginate_postscript { Line 706  sub repaginate_postscript {
  #  we only are looking for the largest n (n is page number at the   #  we only are looking for the largest n (n is page number at the
  #  bottom of the page, m the page number within the document.   #  bottom of the page, m the page number within the document.
  #   #
  if ($line =~ "^%%Page:") {   if ($line =~ /^%%Page:/) {
     my @pageinfo = split(/ /, $line);      my @pageinfo = split(/ /, $line);
     if ($page_number < $pageinfo[1]) {      if ($page_number < $pageinfo[1]) {
  $page_number = $pageinfo[1];   $page_number = $pageinfo[1];
Line 713  sub repaginate_postscript { Line 715  sub repaginate_postscript {
  #  ENDOFSTUDENTSTAMP - save the page_number, reset and, if necessary   #  ENDOFSTUDENTSTAMP - save the page_number, reset and, if necessary
  #                      udpate max_pages.   #                      udpate max_pages.
  #   #
  if ($line =~ "ENDOFSTUDENTSTAMP") {   if ($line =~ /ENDOFSTUDENTSTAMP/) {
     $pages_in_student[$student_number] = $page_number;      $pages_in_student[$student_number] = $page_number;
     $student_number++;      $student_number++;
   
Line 753  sub repaginate_postscript { Line 755  sub repaginate_postscript {
     $total_pages += $add_pages;      $total_pages += $add_pages;
     $student_number = 0;      $student_number = 0;
     
    open(PSFILE, "<$postscript_filename");      open(PSFILE, "<$postscript_filename");
     open(PSOFILE,">$postscript_filename"."repaginating"); # unique if original fname is.      open(PSOFILE,">$postscript_filename"."repaginating"); # unique if original fname is.
     $seen_pages = 0; # Reset seen %%Pages flag...      $seen_pages = 0; # Reset seen %%Pages flag...
     while ($line = <PSFILE>) {      while ($line = <PSFILE>) {
  if (($line =~ "^%%Pages:") && (!$seen_pages)) {   if (($line =~ /^%%Pages:/) && (!$seen_pages)) {
     $line = "%%Pages: $total_pages\n";      $line = "%%Pages: $total_pages\n";
     $seen_pages = 1;      $seen_pages = 1;
  }   }
  if ($line =~ "ENDOFSTUDENTSTAMP") {   if ($line =~ /ENDOFSTUDENTSTAMP/) {
     $add_pages = ($max_pages - $pages_in_student[$student_number]);      $add_pages = ($max_pages - $pages_in_student[$student_number]);
     $line = "\n";      $line = "\n";
     my $last_student_page = $pages_in_student[$student_number];      my $last_student_page = $pages_in_student[$student_number];
Line 776  sub repaginate_postscript { Line 778  sub repaginate_postscript {
     }      }
     $student_number++;      $student_number++;
  }   }
  print PSOFILE $line;   print PSOFILE ($line);
     }      }
     close PSOFILE;      close(PSOFILE);
     close PSFILE;      close(PSFILE);
   
     rename($postscript_filename."repaginating", $postscript_filename);      rename($postscript_filename."repaginating", $postscript_filename);
   

Removed from v.1.100  
changed lines
  Added in v.1.101


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