yii2-pdf icon indicating copy to clipboard operation
yii2-pdf copied to clipboard

yii2-pdf is not compatible with mpdf v7+

Open zoran-grujic opened this issue 5 years ago • 1 comments

I wanted to use PHP 7+ and I stumbled into a problem. It is required to use mpdf v7 with PHP 7+ and yii2-pdf does not support mpdf v7+. Is there will to update the yii2-pdf? It seems like the change is rather trivial according to: https://harrybailey.com/2018/08/yii-1-php-7-1-yii-pdf-and-mpdf/

zoran-grujic avatar Jun 07 '19 21:06 zoran-grujic

Just to confirm, I managed to make it work with mpdf v7.1.9. It was required to change single line in PdfResponseFormatter.php:

protected function formatPdf($response) { $mpdf = new \Mpdf\Mpdf([$this->mode, $this->format, $this->defaultFontSize, $this->defaultFont, $this->marginLeft, $this->marginRight, $this->marginTop, $this->marginBottom, $this->marginHeader, $this->marginFooter, $this->orientation ]);

NOTE: class name: \Mpdf\Mpdf constructor accepts array: [$this->mode, $this->format, ... ], there are '[' and ']' around parameter list.

zoran-grujic avatar Jun 07 '19 23:06 zoran-grujic