--- loncom/interface/printout.pl 2009/03/24 10:29:39 1.140
+++ loncom/interface/printout.pl 2024/11/09 16:08:15 1.177
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.140 2009/03/24 10:29:39 foxr Exp $
+# $Id: printout.pl,v 1.177 2024/11/09 16:08:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,14 +40,21 @@ use Apache::lonlocal;
use Apache::lonmsg();
use LONCAPA::Enrollment;
use LONCAPA::Configuration;
+use LONCAPA;
+use Archive::Zip qw( :ERROR_CODES );
use strict;
my $busy_wait_timeout = 30;
+my $pdfs_converted = 0; # non zero if PDF includes (need to fixps).
+
+my $debugging = 0;
sub debug {
- my ($text) = @_;
- print "$text
\n";
+ if ($debugging) {
+ my ($text) = @_;
+ print "$text
\n";
+ }
}
# Determine if a user is operating as a student for this course/domain.
@@ -118,12 +125,12 @@ sub send_error_mail {
if (&is_student()) {
# build the subject and message body:
- # print "sending message to course coordinators.
";
+ &debug("sending message to course coordinators.");
# Todo: Convert badurl into a url from file path:
- my $subject = "Error [$badurl] Print failed for $user".'@'.$domain;
- my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n";
+ my $subject = "Error [$badurl] Print failed for $user".':'.$domain;
+ my $message .= "Print failed to render LaTeX for $user".':'."$domain\n";
$message .= " User was attempting to print: \n";
foreach my $resource (split(/:/,$resources)) {
$message .= " $resource\n";
@@ -137,9 +144,9 @@ sub send_error_mail {
}
my (undef, %receivers) = &Apache::lonmsg::decide_receiver(undef, 0,
1,1,1);
- # print "
sending...section: $env{'request.course.sec'}";
+ &debug("sending...section: $env{'request.course.sec'}");
foreach my $dest (keys %receivers) {
- # print "
dest is $dest";
+ &debug("dest is $dest");
my @destinfo = split(/:/,$dest);
my $user = $destinfo[0];
my $dom = $destinfo[1];
@@ -154,6 +161,36 @@ sub send_error_mail {
}
}
+sub get_pstops_offsets {
+ my ($paper) = @_;
+ my ($origwidth,$origheight,$origunits,$ptype,$xoff,$yoffl,$yoffr);
+ $ptype = "-p$paper";
+ if ($paper eq 'letter') {
+ $origwidth = 11.0;
+ $origheight = 8.5;
+ $origunits = 'in';
+ $xoff = $origheight - 0.9;
+ $yoffl = 0.0;
+ } elsif ($paper eq 'legal') {
+ $ptype = '';
+ $origwidth = 14.0;
+ $origheight = 8.5;
+ $origunits = 'in';
+ $xoff = $origheight - 3.0;
+ $yoffl = 0.5;
+ } elsif ($paper eq 'a4') {
+ $origwidth = 29.7;
+ $origheight = 21.0;
+ $origunits = 'cm';
+ $xoff = $origheight;
+ $yoffl = 0.7;
+ }
+ if (($origwidth ne '') && ($yoffl ne '')) {
+ $yoffr = $origwidth/2 + $yoffl;
+ }
+ return ($ptype,$xoff,$yoffl,$yoffr,$origunits);
+}
+
$|=1;
if (! &LONCAPA::loncgi::check_cookie_and_load_env()) {
print <