--- print_pdf.pages.inc	2009-10-03 17:31:09.000000000 +0200
+++ print_pdf.pages_.inc_.txt	2009-10-03 17:27:31.000000000 +0200
@@ -84,7 +84,8 @@
   elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
     _print_pdf_tcpdf($print, $html, $pdf_filename);
   }
-  elseif (basename($print_pdf_pdf_tool) == 'wkhtmltopdf') {
+  //elseif (basename($print_pdf_pdf_tool) == 'wkhtmltopdf') {
+  elseif (substr(basename($print_pdf_pdf_tool), 0, 11) == 'wkhtmltopdf') {
     _print_pdf_wkhtmltopdf($print, $html, $pdf_filename);
   }
   else {
@@ -286,24 +287,35 @@
     $xprocess = proc_open($xcmd, $xdescriptor, $xpipes, NULL, NULL);
   }
 
-  $descriptor = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
-  $cmd = realpath($print_pdf_pdf_tool) ." --page-size $print_pdf_paper_size --orientation $print_pdf_page_orientation --dpi $dpi $print_pdf_wkhtmltopdf_options - -";
+  $descriptor = array(
+  	0 => array('pipe', 'r'), 
+  	1 => array('pipe', 'w'), 
+  	2 => array('pipe', 'w')
+  );
+  
+  // edit : output pdf file to temp folder
+  $pdf_output = file_directory_temp() ."\\". session_id() .".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;
 
+  $pipes = array();
   $process = proc_open($cmd, $descriptor, $pipes, NULL, isset($xvfb_binary) ? array('DISPLAY' => ':'. $xdisplay) : NULL);
 
   if (is_resource($process)) {
+
     fwrite($pipes[0], $html);
     fclose($pipes[0]);
 
-    $pdf = stream_get_contents($pipes[1]);
     fclose($pipes[1]);
-
-    stream_set_blocking($xpipes[2], 0);
+    
+    stream_set_blocking($pipes[2], 0);
     $error = stream_get_contents($pipes[2]);
     if (!empty($error)) {
       watchdog('print_pdf', 'wkhtmltopdf: '. $error);
     }
     fclose($pipes[2]);
+    // edit : read file content then delete file
+    $pdf = file_get_contents($pdf_output);
+    unlink($pdf_output);
 
     $retval = proc_terminate($process);
   }
