Mpdf生成在https服务器上花费的时间太长

时间:2019-06-19 09:01:13

标签: php https yii2 mpdf kartik-v

我正在使用“ Kartik mpdf”插件在yii2项目中生成pdf。在我的本地环境和生产服务器上都可以正常工作。

但是,如果我在生产服务器上添加ssl,则生成pdf文件所需的时间太长。将近8-10分钟。

这是我的pdf生成代码:

<?php

$pdf = new Pdf([
    // set to use core fonts only
    'mode' => Pdf::MODE_CORE,
    // A4 paper format
    'format' => Pdf::FORMAT_A4,
    // portrait orientation
    'orientation' => Pdf::ORIENT_PORTRAIT,
    'destination' => Pdf::DEST_BROWSER,
    'filename' => $filename,
    // your html content input
    'content' => $content,
    // format content from your own css file if needed or use the
    // enhanced bootstrap css built by Krajee for mPDF formatting 
    'cssFile' => '@vendor/kartik-v/yii2-mpdf/src/assets/kv-mpdf-bootstrap.min.css',
    // any css to be embedded if required
    'cssInline' => 'table, tr, td, th, tbody, thead, tfoot{page-break-inside: avoid !important} .kv-heading-1{font-size:18px}.invoice-box table td {padding: 5px;vertical-align: top;} table {page-break-inside: auto;}',
    // set mPDF properties on the fly
    'options' => ['title' => 'New Booking Voucher', 'shrink_tables_to_fit' => 1],
]);

// return the pdf output as per the destination setting
return $pdf->render();

尽管我的pdf的html内容的表结构太复杂,但仍然可以在没有ssl的情况下正常工作,如果我将其替换为平面文字,那么在ssl上也可以正常工作。

我的代码或ssl配置是否存在任何问题。

0 个答案:

没有答案