Mpdf\MpdfException 大小表示无效 "a3"

Mpdf\MpdfException Invalid size representation "a3"

使用 mpdf 库通过加载视图文件生成 pdf 但它抛出

Mpdf\MpdfException Invalid size representation "a3"

代码

 $pdf = new Mpdf(['mode' => 'utf-8']);
 $pdf->WriteHTML(view()->make('reports.transactions.report', [
                'transactions' => $transactions,
                'from'         => $start ? $start->format('d-M-Y') : '',
                'to'           => $end ? $end->format('d-M-Y') : '',
                'generatedOn'  => Carbon::now()->format('d-M-Y h:i:s'),
                'credit'       => $this->getTotalCredits($transactions),
                'debit'        => $this->getTotalDebits($transactions),
            ]));

 return $pdf->Output('transaction_pdf.pdf','D');

使用 Laravel 5.6PHP 7.1bootstrap 4 样式

非常感谢任何帮助:)

我也有这个错误。它确实与 Bootstrap4 有关。但仍在研究中。

BS4套数:

@page {
size: a3; }

mPdf 似乎不认识这个或者 BS4 使用错误 style-attribute。如果你使用BS4的sass-version,那么你可以用var:

来改变它
// Printing
$print-page-size:    a3 !default;

更新: 我看了:https://mpdf.github.io/paging/using-page.html 并在 BS4 中将 page-size 设置为 'auto'。虽然我的页面还没有工作,但错误消失了 ;-) 但那是另外一回事。

你好,flexjoly