Hi I am using a Mac and XAMPP. Prince works in the command line but not with PHP. The log file is being created but has no content. I think the path to Prince in the constructor is correct but it doesn't seem to make a difference when I put in an incorrect path. $prince->convert_string_to_passthru is just returning false. In Chrome it says "Failed to load PDF document" and Firefox says "This PDF document might not be displayed correctly".
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include 'prince.php';
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png" />
</body>
</html>
<?php
$out = ob_get_clean();
$prince = new Prince('/usr/local/bin/prince');
$prince->setHTML(1);
$temp_file = tempnam(sys_get_temp_dir(), 'prince_');
chmod($temp_file, 0777);
error_log('temp file name: '.$temp_file);
$prince->setLog($temp_file);
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="foo.pdf"');
$prince->convert_string_to_passthru($out);