kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
163 stars 149 forks source link

update to allow use of Mpdf 7.0 and PHP 7.1. #51

Closed jannes-io closed 7 years ago

jannes-io commented 7 years ago

Steps to reproduce the issue

  1. use a php 7.1 environment
  2. attempt to use the kartik-v/yii2-mpdf library

Expected behavior and actual behavior

When I follow those steps, I see a whole bunch of errors because mpdf 6 does not support PHP 7.1.X and yii-mpdf does not support a higher version of mpdf. It works fine if I just use the mpdf library to export simple pages but when used in combination of other elements (such as the GridView widget it throws an error.

`Invalid Configuration – yii\base\InvalidConfigException

The class '\kartik\mpdf\Pdf' was not found and is required for PDF export functionality. To include PDF export, follow the install steps below. If you do not need PDF export functionality, do not include 'PDF' as a format in the 'export' property. You can otherwise set 'export' to 'false' to disable all export functionality.

Please ensure you have installed the 'yii2-mpdf' extension. To install, you can run this console command from your application root:

php composer.phar require kartik-v/yii2-mpdf: "@dev"`

Your wrapper should be updated to support the new PHP versions as well as the latest Mpdf version. Please update.

Environment

Xampp, PHP 7.1.1

Browsers

Operating System

Libraries

Isolating the problem

kartik-v commented 7 years ago

mpdf 7.0 is in beta and not in stable release yet.

jannes-io commented 7 years ago

It's a lot more stable than using PHP 7.1 with yii2-mpdf..

So what is the solution for people who are stuck using PHP 7+?

kartik-v commented 7 years ago

It's a lot more stable than using PHP 7.1 with yii2-mpdf..

Based on above will need to figure out release and dependencies here... as it cannot be just addressed in context of PHP 7.1

jannes-io commented 7 years ago

I removed the yii2-mpdf package, updated mpdf to 7.0.0-beta2, then changed my code and I am running it perfectly on my test xampp (PHP 7.1.1) and on my production server (PHP 7.1.3).

kartik-v commented 7 years ago

Still I am not sure of the support of mpdf-7.0beta for other lesser versions of PHP < 7.x...

give me some time will need to create another release specific for 7.1 -

jannes-io commented 7 years ago

The only issue I encounter now is that the yii2-gridview can not export to PDF, but that is a different github project. Fixed it by just changing the export options to not include PDF since it still uses the yii2-mpdf. If you need any code or need anything tested on PHP7 let me know I'd be willing to help out.

mhoogstraten commented 7 years ago

Any update on this?

StalkAlex commented 7 years ago

I did some work already adopting last version of PHP and mPdf. There's already opened issue on this problem https://github.com/kartik-v/yii2-mpdf/issues/45#issuecomment-291846586. @mhoogstraten you could give a try to my forked version until author will figure something out.

StalkAlex commented 7 years ago

Same as here https://github.com/kartik-v/yii2-mpdf/issues/45#issuecomment-309336095

juanisorondo commented 6 years ago

@kartik-v anything I can do to help speed up yii2-mpdf with mPDF 7.0?

Code worked fine in my app, wondering if its just the v1.0.2 tag that's missing.

kartik-v commented 6 years ago

@juanisorondo I released 1.0.2 tag... can you check and update if anything... thanks