Commit 26081159 authored by jcnventura's avatar jcnventura

Fix #631150 by smk-ka: wkhtmltopdf on windows can use the output pipe again

parent 45626194
......@@ -302,8 +302,7 @@ function _print_pdf_wkhtmltopdf($print, $html, $filename) {
}
$descriptor = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$pdf_output = (stristr(PHP_OS, 'Win')) ? tempnam(variable_get('file_temporary_path', conf_path() . '/private/temp'), 'pdf') : '-';
$cmd = realpath($print_pdf_pdf_tool) . " --page-size $print_pdf_paper_size --orientation $print_pdf_page_orientation --dpi $dpi $print_pdf_wkhtmltopdf_options - $pdf_output";
$cmd = realpath($print_pdf_pdf_tool) . " --page-size $print_pdf_paper_size --orientation $print_pdf_page_orientation --dpi $dpi $print_pdf_wkhtmltopdf_options - -";
$process = proc_open($cmd, $descriptor, $pipes, NULL, NULL);
......@@ -311,14 +310,7 @@ function _print_pdf_wkhtmltopdf($print, $html, $filename) {
fwrite($pipes[0], $html);
fclose($pipes[0]);
if (stristr(PHP_OS, 'Win')) {
// It seems Windows can't use the pipe properly so get the contents from a file and then delete it.
$pdf = file_get_contents($pdf_output);
unlink($pdf_output);
}
else {
$pdf = stream_get_contents($pipes[1]);
}
$pdf = stream_get_contents($pipes[1]);
fclose($pipes[1]);
stream_set_blocking($pipes[2], 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment