Permalink
Browse files

MDL-42240 assignfeedback_editpdf: improve ghostscript debugging

  • Loading branch information...
danpoltawski committed Oct 10, 2013
1 parent 00ae230 commit 9092378ddbd1aa07aacd17fe52589a04a079dfe2
@@ -401,11 +401,16 @@ public function get_image($pageno) {
"-dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sOutputFile=\"$imagefile\" \"$filename\"";
//$command = escapeshellcmd($command);
$result = exec($command);
$output = null;
$result = exec($command, $output);
if (!file_exists($imagefile)) {
$fullerror = 'Command:' . ($command) . '<br/>';
$fullerror .= 'Result:' . htmlspecialchars($result) . '<br/>';
throw new \moodle_exception('errorgenerateimage', 'assignfeedback_pdf', '', $fullerror);
$fullerror = '<pre>'.get_string('command', 'assignfeedback_editpdf')."\n";
$fullerror .= $command . "\n\n";
$fullerror .= get_string('result', 'assignfeedback_editpdf')."\n";
$fullerror .= htmlspecialchars($result) . "\n\n";
$fullerror .= get_string('output', 'assignfeedback_editpdf')."\n";
$fullerror .= htmlspecialchars(implode("\n",$output)) . '</pre>';
throw new \moodle_exception('errorgenerateimage', 'assignfeedback_editpdf', '', $fullerror);
}
}
@@ -33,6 +33,7 @@
$string['colourpicker'] = 'Colour Picker';
$string['commentcolour'] = 'Comment color';
$string['comment'] = 'Comments';
$string['command'] = 'Command:';
$string['commentcontextmenu'] = 'Comment context menu';
$string['couldnotsavepage'] = 'Could not save page {$a}';
$string['currentstamp'] = 'Stamp';
@@ -41,6 +42,7 @@
$string['deletefeedback'] = 'Delete feedback PDF';
$string['downloadablefilename'] = 'feedback.pdf';
$string['downloadfeedback'] = 'Download feedback PDF';
$string['errorgenerateimage'] = 'Error generating image with ghostscript, debugging info: {$a}';
$string['editpdf'] = 'Annotate PDF';
$string['editpdf_help'] = 'Annotate students submissions directly in the browser and produce an edited downloadable PDF.';
$string['enabled'] = 'Annotate PDF';
@@ -59,11 +61,13 @@
$string['navigatenext'] = 'Next page';
$string['navigateprevious'] = 'Previous page';
$string['oval'] = 'Oval';
$string['output'] = 'Output:';
$string['pagexofy'] = 'Page {$a->page} of {$a->total}';
$string['pen'] = 'Pen';
$string['pluginname'] = 'Annotate PDF';
$string['rectangle'] = 'Rectangle';
$string['red'] = 'Red';
$string['result'] = 'Result:';
$string['searchcomments'] = 'Search comments';
$string['select'] = 'Select';
$string['stamppicker'] = 'Stamp picker';

0 comments on commit 9092378

Please sign in to comment.