1

I'm trying to generate a pdf using snappy through this code:

$snappy = new SnappyPdf;

$snappy->setExecutable('/usr/bin/wkhtmltopdf');

$snappy->save('http://www.google.com', '/tmp/jander.pdf');

In the apache log i find this:

Done Loading pages (1/6) [>
] 0% [======>
] 10% [==========>
] 18% [============>
] 20% [=============>
] 22% [===============>
] 25% [================>
] 28% [==================>
] 30% [===================>
] 33% [=====================>
] 35% [======================>
] 37% [=========================>
] 43% [===========================>
] 46% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1 Done

but the pdf is not generated.

Any idea?

Javier

4

2 回答 2

2

我建议你从查看返回值开始$snappy->save()。根据代码,如果输出的 PDF 文件已创建且文件不为空,则返回 true。

您可能还想检查代码$this->buildCommand($url, $path)第 37 行的输出。尝试在您的服务器上手动执行此代码。

于 2011-02-23T17:44:40.340 回答
1

利用$snappy->generate

或者

$snappy->generateFromHtml($htmlstring, 'path/to/save/file')

于 2012-10-27T10:58:24.640 回答