[LON-CAPA-cvs] cvs: loncom /interface printout.pl
raeburn
raeburn at source.lon-capa.org
Thu Jul 11 11:24:01 EDT 2024
raeburn Thu Jul 11 15:24:01 2024 EDT
Modified files:
/loncom/interface printout.pl
Log:
- Bug 5899 "printing a pdf file in a course via the printing option"
Support GhostScript 9.50 and newer (in which SAFER mode is enabled by
default).
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.171 loncom/interface/printout.pl:1.172
--- loncom/interface/printout.pl:1.171 Thu Jul 11 12:44:40 2024
+++ loncom/interface/printout.pl Thu Jul 11 15:24:01 2024
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.171 2024/07/11 12:44:40 raeburn Exp $
+# $Id: printout.pl,v 1.172 2024/07/11 15:24:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -544,7 +544,19 @@
last if ($device ne '');
}
if ($device ne '') {
- $comma = "gs -sDEVICE=$device -dLanguageLevel=1.5 --permit-file-read=* ";
+ my ($major,$minor);
+ if (open(PIPE,"gs -v |grep 'GPL Ghostscript' 2>&1 |")) {
+ my $info = <PIPE>;
+ close(PIPE);
+ chomp($info);
+ if ($info =~ /Ghostscript\s+(\d+)\.(\d+)/) {
+ ($major,$minor) = ($1,$2);
+ }
+ }
+ $comma = "gs -sDEVICE=$device -dLanguageLevel=1.5 ";
+ if (($major > 9) || (($major == 9) && ($minor >= 50))) {
+ $comma .= '--permit-file-read=* ';
+ }
&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);
More information about the LON-CAPA-cvs
mailing list