) {
if ($line eq "\\special{ps:ENDOFSTUDENTSTAMP}\n") {
@@ -768,8 +810,7 @@ sub repaginate {
}
$student_number++;
- &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,
- "Repaginating student ".$student_number+1);
+ &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,&mt("Repaginating student: [_1]",$student_number+1));
} else {
print LATEXOUT $line;
@@ -845,12 +886,13 @@ sub create_missing_fonts {
#
sub convert_figure {
my ($not_eps) = @_;
+ &debug("in convert_figure");
my $status_statement='EPS picture for '.$not_eps;
my $eps_f = $not_eps;
- if ($eps_f=~/\/home\/([^\/]+)\/public_html\//) {
- $eps_f=~s/\/home\/([^\/]+)\/public_html/$1/;
+ if ($eps_f=~/\/home\/httpd\/html\/priv\/[^\/]+\/([^\/]+)\//) {
+ $eps_f=~s/\/home\/httpd\/html\/priv\/[^\/]+\/([^\/]+)/$1/;
} elsif ($eps_f=~/$perlvar{'lonDocRoot'}\/res\//) {
$eps_f=~ s/$perlvar{'lonDocRoot'}\/res\/(.+)/$1/;
} elsif ($eps_f=~/$perlvar{'lonUsersDir'}\//) {
@@ -881,14 +923,37 @@ sub convert_figure {
$not_eps =~ s/^\s+//;
$not_eps =~ s/\s+$//;
$not_eps =~ s/ /\\ /g;
+ my $prettyname=$not_eps;
if ($advanced_role) {
- my $prettyname=$not_eps;
- $prettyname=~s|/home/([^/]+)/public_html|/priv/$1|;
$prettyname=~s|$perlvar{'lonDocRoot'}/|/|;
- &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,
- 'Converting to EPS '.$prettyname);
+ &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,&mt('Converting to EPS: [_1]',$prettyname));
+ }
+ #
+ # If the file is a PDF, need to use pdftops to convert it to a ps file.
+ # otherwise use imagemagik:
+ #
+ if($not_eps =~/\.(pdf|PDF)$/) {
+
+ #
+ # For whatever reason, pure postscript conversions have to be
+ # in the same dir as the base file:
+ #
+ $eps_f = &basename($eps_f);
+ $eps_f = $perlvar{'lonPrtDir'}.'/'.$eps_f;
+
+ &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){
+ print ""
+ .mt("An error occured during the conversion of [_1].[_2]"
+ ."If possible try to save this image using different settings and republish it.",
+ "".$prettyname."", "
")
+ ."
";
+ }
}
- system("convert $not_eps $eps_f");
if (not -e $eps_f) {
# converting an animated gif creates either:
@@ -972,7 +1037,7 @@ sub analyze_logfile {
if ($advanced_role) {
#LaTeX failed to parse tex file
- print "".&mt('LaTeX could not successfully parse your tex file.')."
";
+ print "".&mt('LaTeX could not successfully parse your TeX file.')."
";
print &mt('It probably has errors in it.')."
";
if ($badtext) {
print &mt('With very high probability this error occured in [_1].',$badtext)
@@ -1025,13 +1090,15 @@ sub analyze_logfile {
# $name_file - is the name of the LaTeX file.
# $identifier - is the unique LaTeX identifier.l
- print "
";
+ print '';
if ($badtext) {
print &mt('There are errors in [_1].',$badtext);
} else {
print &mt('There are errors.');
}
- print "
".&mt('These errors prevent this resource from printing correctly.');
+ print '
'
+ .&mt('These errors prevent this resource from printing correctly.');
+
my $tex_handle = IO::File->new($texfile);
my @tex_contents = <$tex_handle>;
&send_error_mail($identifier, $badresource, $body_log_file, \@tex_contents);