phpwkhtmltopdf: Failed with Error "Loading pages (1/6) [> ] 0% [======> ] 10%"
I tested with following code:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once __DIR__.'/vendor/autoload.php';
use mikehaertl\wkhtmlto\Pdf;
$pdf = new Pdf('<html><head></head><body>Hello pdf</body></html>');
$pdf->binary = '/usr/local/bin/wkhtmltopdf';
if (!$pdf->saveAs('/var/www/cgi-bin/pdf/test.pdf')) {
echo $pdf->getError();
}
?>
The Page only displays: “Loading pages (1/6) [> ] 0% [======> ] 10%”
My Testserver:
[root@dev-php-composer pdf]# apachectl -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 24 2015 17:52:49
[root@dev-php-composer pdf]# php -v
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@dev-php-composer pdf]# uname -a
Linux dev-php-composer 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
/var/www/cgi-bin/pdf/ has this linux rights drwxr-xr-x and user apache
Any Tips to get it working?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 60 (23 by maintainers)
my particular issue was the usage of data-uri’s in image tags. letting
wkhtmltopdffetch the images with a http request solved the problem, table renders!For anyone still interested:
I’ve meanwhile completely refactored the way we work with the I/O streams with
proc_open(). This was probably the root cause for many weird hanging issues and the fix is not really trivial. If you have a chance to give it a try, this would be great.You’d have to replace your copy of
vendor/mikehaertl/php-shellcommandwith the branch 20-add-stream_set_blocking-calls from this PR: https://github.com/mikehaertl/php-shellcommand/pull/41.Any feedback welcome - but please comment on the related issue of php-shellcommand.
I’ve released 2.4.1 which will use the latest version of php-shellcommand which should fix many issues with commands that generate a lot of output (which is probably the main reason for many issues).
So I’m closing this for now. If there are still issues, feel free to leave a comment.
@mikehaertl thank you, i assume you are right. if i get any time i will see if i can figure anything out
Hmm. Not sure then. Must have to do with
wkthmltopdfand how it loads images. It never was perfect. So maybe the Chrome based library that @daudmalik06 posted above works for you.