「phpwkhtmltopdf」の何かが機能しなくなりました。
次のコードを使用して Web ブラウザーで実行します。
$string = "http://www.google.com";
// You can add parameter for the constructor call
$binary = '/usr/bin/wkhtmltopdf';
$pdf = new Pdf(array(
// Explicitly tell wkhtmltopdf that we're using an X environment
// 'use-xserver',
// Enable built in Xvfb support in the command
'commandOptions' => array(
'enableXvfb' => true,
// Optional: Set your path to xvfb-run. Default is just 'xvfb-run'.
'xvfbRunBinary' => '/usr/bin/xvfb-run',
// Optional: Set options for xfvb-run. The following defaults are used.
//'xvfbRunOptions' => '--server-args="-screen 0, 1024x768x24"',
),
));
$options = array(
// 'page-width' => '216mm',
// 'page-height' => '279mm',
'page-size' => 'A4',
//'dpi' => 96,
//'image-quality' => 100,
//'disable-smart-shrinking',
//'no-outline',
//'no-outline', // option without argument
'encoding' => 'UTF-8', // option with argument
'user-style-sheet' => $cssPath,
'margin-top' => 0,
'margin-right' => 0,
'margin-bottom' => 0,
'margin-left' => 0
// 'orientation' => 'portrait',
// 'images' => true,
// 'cookie' => array(),
//'dpi' => 1000
// 'image-dpi' => 300
// Default page options
// 'enable-smart-shrinking'
);
//$pdf->setOptions( $options );
$pdf->binary = $binary;
$pdf->addPage($string);
$pdf->saveAs(FCPATH."files/weekly_reports/$prod_id-Weekly-Report.pdf");
var_dump($pdf);
私はそれをロードしてロードしてロードしてロードしています...パテウィンドウの動作が非常に遅くなり、プロセッサが100%にジャンプします。service apache2 restart
virtualboxを管理または再起動するまで、すべてが動かなくなります。
CLI での実行:
wkhtmltopdf http://google.com google.pdf
私はこの出力を得る:
QXcbConnection: Could not connect to display
Aborted (core dumped)
私がした唯一のことは、dist-update と upgrade でした。PHP5 が 7 に変更されました。何が問題になる可能性がありますか? 誤って削除されたパッケージがある可能性がありますか? 今まではうまくいきました。
これを CLI で実行すると、次のようになります。
xvfb-run wkhtmltopdf http://google.com test.pdf
それはところで動作します..