--- loncom/interface/printout.pl 2011/04/26 10:47:25 1.148 +++ loncom/interface/printout.pl 2011/05/18 11:26:44 1.149 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.148 2011/04/26 10:47:25 foxr Exp $ +# $Id: printout.pl,v 1.149 2011/05/18 11:26:44 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,7 +44,7 @@ use LONCAPA::Configuration; use strict; my $busy_wait_timeout = 30; - +my $pdfs_converted = 0; # non zero if PDF includes (need to fixps). my $debugging = 0; @@ -490,15 +490,18 @@ foreach $texfile (@texfile) { # The code below uses gs to make pdf includes in sequences work # Use gs to fix the postscript -> level 1.5 + # .. if pdfs were included - $comma = "gs -sDEVICE=pswrite -dLanguageLevel=1.5 "; - &busy_wait_command("$comma -o $tempo_file $new_name_file 2>/dev/null 1>/dev/null", - "for $status_statement now validating PS", - \%prog_state, $tempo_file); - + if ($pdfs_converted > 0) { + $comma = "gs -sDEVICE=pswrite -dLanguageLevel=1.5 "; + &busy_wait_command("$comma -o $tempo_file $new_name_file 2>/dev/null 1>/dev/null", + "for $status_statement now validating PS", + \%prog_state, $tempo_file); + #--- - &busy_wait_command("mv $tempo_file $new_name_file", - 'File move', \%prog_state, $new_name_file); + &busy_wait_command("mv $tempo_file $new_name_file", + 'File move', \%prog_state, $new_name_file); + } if ($laystyle eq 'album' and $numberofcolumns eq '2') { $comma = "psnup $papera -2 -s1.0 $new_name_file"; &debug("PSNUP command: $comma"); @@ -948,6 +951,7 @@ sub convert_figure { &debug("Converting pdf $not_eps to postscript: $eps_f"); system("pdftops $not_eps $eps_f"); + $pdfs_converted++; # Need to fix ps in last pass. } else { system("convert $not_eps $eps_f"); if($? and $advanced_role){