开发者

Trying to generate a pdf using Snappy (wkhtmltopdf wrapper)

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

$snappy = new SnappyPdf;

$snappy->setExecutable('/usr/bin/wkhtmltopd开发者_高级运维f');

$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


I suggest you start by looking at the return value from $snappy->save(). According to the code, it will return true if the outputted PDF file is created and the file is not empty.

You might also want to check the output of $this->buildCommand($url, $path) on line 37 of the code. Try manually executing this code on your server.


use $snappy->generate

or

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜