Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mpdf v7 fatal error #37

Closed
fl0pp opened this issue Oct 27, 2016 · 0 comments
Closed

Mpdf v7 fatal error #37

fl0pp opened this issue Oct 27, 2016 · 0 comments

Comments

@fl0pp
Copy link

fl0pp commented Oct 27, 2016

I try to generate a PDF from your samples, but get an Fatal error:

Fatal error: Uncaught TypeError: Argument 1 passed to PhpOffice\PhpSpreadsheet\Writer\PDF\MPDF::__construct() must be an instance of PhpOffice\PhpSpreadsheet\Spreadsheet, none given, called in <mypath>\vendor\PhpSpreadsheet\src\PhpSpreadsheet\Writer\PDF\MPDF.php on line 92 and defined in <mypath>\vendor\PhpSpreadsheet\src\PhpSpreadsheet\Writer\PDF\MPDF.php on line 42
  • PhpSpreadsheet develop branch (commit 3cc80bd)
  • Mpdf v 7.0.0
  • PHP v 7.0.10RC1
  • OS: Windows 8.1

When I load Mpdf separatly, and use namespaces it works.
I changed the line src\PhpSpreadsheet\Writer\PDF\MPDF.php:92 from

$pdf = new self();

to

$pdf = new \Mpdf\Mpdf();
Mirocow pushed a commit to Mirocow/PhpSpreadsheet that referenced this issue Jan 16, 2017
Some references to classes were incorrectly assumed to be a reference
to self, whereas they were references to classes in global namespace
outside of this project.

FIX PHPOffice#37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant