0

I am trying to render pdf file with dompdf, but I got this issue:

required parameter $dompdf follows optional parameter $paper

image - required parameter $dompdf follows optional parameter $paper

Daniel AC
  • 63
  • 2
  • 12
  • Does this answer your question? [Required parameter $xxx follows optional parameter $yyy](https://stackoverflow.com/questions/65297279/required-parameter-xxx-follows-optional-parameter-yyy) – miken32 Nov 13 '21 at 21:09

2 Answers2

1

It probably happens because you are using php 8, and your current laravel dompdf doesn't support new changes of php 8.

To fix it try to use this line in your composer dependency:

"barryvdh/laravel-dompdf": "^0.9.0"

and run:

composer update

For more details see:

https://github.com/barryvdh/laravel-dompdf/issues/747

And you can see what happens in php-8 with function parameters in this issue:

Required parameter $xxx follows optional parameter $yyy

RiveN
  • 2,595
  • 11
  • 13
  • 26
Daniel AC
  • 63
  • 2
  • 12
0

Optional parameter $paper declared before required parameter $dompdf is implicitly treated as a required parameter

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 02 '23 at 09:40