Skip to content
Snippets Groups Projects
Commit 7ceeeb7f authored by Kevin Kaland's avatar Kevin Kaland
Browse files

Issue #1694854: Buffer passthru() to ensure full PDF is captured.

parent f410029f
No related branches found
No related tags found
No related merge requests found
...@@ -706,8 +706,10 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt ...@@ -706,8 +706,10 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt
// Generate the file // Generate the file
$xfdffile = file_save_data($xfdf, $xfdfname, FILE_EXISTS_RENAME); $xfdffile = file_save_data($xfdf, $xfdfname, FILE_EXISTS_RENAME);
// Now feed this to pdftk and save the result to a variable // Now feed this to pdftk and save the result to a variable
$data = shell_exec('pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' fill_form ' . escapeshellarg(drupal_realpath($xfdffile->uri)) . ' output - ' . ($flatten ? 'flatten ' : '') . 'drop_xfa'); ob_start();
if ($data === NULL) { passthru('pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' fill_form ' . escapeshellarg(drupal_realpath($xfdffile->uri)) . ' output - ' . ($flatten ? 'flatten ' : '') . 'drop_xfa');
$data = ob_get_clean();
if ($data === FALSE) {
drupal_set_message(t('pdftk not properly installed. No PDF generated.'), 'error'); drupal_set_message(t('pdftk not properly installed. No PDF generated.'), 'error');
} }
file_delete($xfdffile); file_delete($xfdffile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment