MDL-42240 assignfeedback_editpdf: improve ghostscript debugging

This commit is contained in:
Dan Poltawski 2013-10-10 13:05:17 +08:00
parent 00ae230f52
commit 9092378ddb
2 changed files with 13 additions and 4 deletions

View File

@ -401,11 +401,16 @@ class pdf extends \FPDI {
"-dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sOutputFile=\"$imagefile\" \"$filename\""; "-dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sOutputFile=\"$imagefile\" \"$filename\"";
//$command = escapeshellcmd($command); //$command = escapeshellcmd($command);
$result = exec($command); $output = null;
$result = exec($command, $output);
if (!file_exists($imagefile)) { if (!file_exists($imagefile)) {
$fullerror = 'Command:' . ($command) . '<br/>'; $fullerror = '<pre>'.get_string('command', 'assignfeedback_editpdf')."\n";
$fullerror .= 'Result:' . htmlspecialchars($result) . '<br/>'; $fullerror .= $command . "\n\n";
throw new \moodle_exception('errorgenerateimage', 'assignfeedback_pdf', '', $fullerror); $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);
} }
} }

View File

@ -33,6 +33,7 @@ $string['clear'] = 'Clear';
$string['colourpicker'] = 'Colour Picker'; $string['colourpicker'] = 'Colour Picker';
$string['commentcolour'] = 'Comment color'; $string['commentcolour'] = 'Comment color';
$string['comment'] = 'Comments'; $string['comment'] = 'Comments';
$string['command'] = 'Command:';
$string['commentcontextmenu'] = 'Comment context menu'; $string['commentcontextmenu'] = 'Comment context menu';
$string['couldnotsavepage'] = 'Could not save page {$a}'; $string['couldnotsavepage'] = 'Could not save page {$a}';
$string['currentstamp'] = 'Stamp'; $string['currentstamp'] = 'Stamp';
@ -41,6 +42,7 @@ $string['deletecomment'] = 'Delete comment';
$string['deletefeedback'] = 'Delete feedback PDF'; $string['deletefeedback'] = 'Delete feedback PDF';
$string['downloadablefilename'] = 'feedback.pdf'; $string['downloadablefilename'] = 'feedback.pdf';
$string['downloadfeedback'] = 'Download feedback PDF'; $string['downloadfeedback'] = 'Download feedback PDF';
$string['errorgenerateimage'] = 'Error generating image with ghostscript, debugging info: {$a}';
$string['editpdf'] = 'Annotate PDF'; $string['editpdf'] = 'Annotate PDF';
$string['editpdf_help'] = 'Annotate students submissions directly in the browser and produce an edited downloadable PDF.'; $string['editpdf_help'] = 'Annotate students submissions directly in the browser and produce an edited downloadable PDF.';
$string['enabled'] = 'Annotate PDF'; $string['enabled'] = 'Annotate PDF';
@ -59,11 +61,13 @@ $string['loadingeditor'] = 'Loading PDF editor';
$string['navigatenext'] = 'Next page'; $string['navigatenext'] = 'Next page';
$string['navigateprevious'] = 'Previous page'; $string['navigateprevious'] = 'Previous page';
$string['oval'] = 'Oval'; $string['oval'] = 'Oval';
$string['output'] = 'Output:';
$string['pagexofy'] = 'Page {$a->page} of {$a->total}'; $string['pagexofy'] = 'Page {$a->page} of {$a->total}';
$string['pen'] = 'Pen'; $string['pen'] = 'Pen';
$string['pluginname'] = 'Annotate PDF'; $string['pluginname'] = 'Annotate PDF';
$string['rectangle'] = 'Rectangle'; $string['rectangle'] = 'Rectangle';
$string['red'] = 'Red'; $string['red'] = 'Red';
$string['result'] = 'Result:';
$string['searchcomments'] = 'Search comments'; $string['searchcomments'] = 'Search comments';
$string['select'] = 'Select'; $string['select'] = 'Select';
$string['stamppicker'] = 'Stamp picker'; $string['stamppicker'] = 'Stamp picker';