Prince xml在生成带有php的测试文件时出现问题


Prince xml trouble generating test file w/ php

我在开始使用Princexml时遇到问题。我正在尝试创建我的第一个测试PDF。

这是我的代码:

require_once dirname(__FILE__).'/prince.php';
$prince = new Prince('/usr/local/bin/prince');
$prince->setHTML(1);
$prince->setLog("/log.txt");
$prince->setPDFTitle("Test File");
$html = file_get_contents(dirname(__FILE__)."/out/test.html");
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="foo.pdf"');
$ret = $prince->convert_string_to_passthru($html);

test.html文件包含以下内容:

<!DOCTYPE html>
<html>
<head></head>
<body>
    <h1>hello world!</h1>
</body>
</html>

PDF正在加载(如果我使用"内联"而不是附件),但它是一个空白文档。当我使用"附件"时,文件大小为0字节。

我不明白我在这里做错了什么。有什么想法吗??

我找到了答案。这显然是MAMP的问题:

http://www.princexml.com/forum/topic/1292/prince-on-os-x-mamp