Hello,
I'm trying to export a PDF using mPDF. On my development server this works fine. I'm able to export as expected. On my production server, I get the following:

I am able to export Excel no problem. It just happens with a PDF export. I've tried debugging this the best I can. I've checked the php configuration; everything looks the same. I cannot find what would throw this error. Does anyone know why I would not be able to export out a PDF? I'm out of ideas here.
Thank you for any help you might be able to provide.
Hi @codebykyle
Not sure what your development environment is, or any technical detail so i'll just make a stab in the dark for you: can you try using something like POSTMAN or Insomnia (https://insomnia.rest/) to make a request to an endpoint you'd expect to see the PDF come back from -- you could for example build a temporary route / endpoint to get the PDF data, put that URI into insomnia or postman and post or get request - you'll see all the data come back in raw format along with headers in an easy to digest way.
If you can do that and let me see some screenshots or some of the raw data as a paste / gist i'll be able to help you some more
Hey @TakesTheBiscuit
Thanks a bunch for the reply. I'm using an AWS Lightsail Bitnami LEMP stack instance as production, and Laravel Homestead as a dev server. The AWS instance runs php 5.6.30 -- the homestead dev env runs a newer version of PHP. Beyond that, they should be near identical. I am not able to get it to actually dump out any error information other than it is a 500 error code. Chrome produces no information other than an ERR_INVALID_RESPONSE.
Testing it in postman I just get a blank 500 error. Internet explorer, the only thing I can get any information out of (ugh!) produces the same result. Do you have any ideas on how to get the error to produce something? Im assuming this comes down like this because it is properly setting the content-type header with ->download() to an attachment/pdf, so its not actually producing an output to be able to debug it properly... Any suggestions here?

The only difference between the two exports is one is a PDF format, and the other is Excel:
In the case of PDF: pdf is passed to download, in the case of excel, xlsx
$export = $timeExport->setDocumentDetails($documentDetails)
->setUserDetails($userDetails)
->setFormalData($cpdRecords)
->export();
if ($method === 'print') {
return response()->json($export->string('html'));
} else {
return $export->download($method);
}
Export function:
/**
* @return mixed
*/
public function export()
{
return Excel::create($this->getFileName(), function (LaravelExcelWriter $excel) {
$excel->sheet($this->getSheetName(), function (LaravelExcelWorksheet $sheet) {
...various generation/styling code
});
});
}
I resolved this. I had a permissions error on a file in mpdf.
specifically, vendor/mpdf/mpdf/classes/ttfontsuni.php:1264
a simple chown fixed this.
Thank you for your help!
@codebykyle can you say how you did it (specifically) ?
please
chown -R www-data ./vendor/mdpf
@Thanks a lot for your time, but don't work for me, i have the same problem yet "/
If its a permissions issue, make sure you are providing the correct permissions to whichever account is running apache or nginx. Thats how I fixed this. It might not be www-data for you, maybe
I would normally let composer set permissions - who/which account do you run composer as?
Most helpful comment
I resolved this. I had a permissions error on a file in mpdf.
specifically,
vendor/mpdf/mpdf/classes/ttfontsuni.php:1264a simple chown fixed this.
Thank you for your help!