Make sure you have installed the requirements https://github.com/dompdf/dompdf#requirements
Dompdf not working in production
Hi folks - A bit off-topic here. I'm using Barryvdh/DomPDF to produce user pdfs. Everything is working in my local environment, with one odd issue, but in production (DigitalOcean) nothing seems to be happening when I click the link and no error messages are being logged.
The controller:
use Barryvdh\DomPDF\Facade as PDF;
public function pdf()
{
... Create variables...
$invoice = PDF::loadView('registrants.pdfs.invoice',
[
'balance' => $balance,
'due' => $due,
'event' => Event::getCurrentEvent(),
'paid' => $paid,
'registrationfee' => $registrationfee,
'readingsessions' => $readingsessions,
'readingsessionsfee' => $readingsessionsfee,
])
->setPaper('letter','portrait');
return $invoice->download('MySummerConferenceInvoice.pdf');
}
The one odd issue is the PDF in PDF::loadView is struck-through (i.e. it has a line through it). I'm using PHPStorm as my IDE, but I haven't figured out what the IDE is trying to tell me.
In production, I've done a "php artisan optimize" and "composer update", so I think I'm all-good there.
Any thoughts or suggestions are appreciated!
Best - Rick
@sinnbeck Thanks for the response! I checked and all of the requirements are being met. However, In case this helps someone else, the solution to the problem is in the app/Http/Middleware/TrustProxies.php file. I discovered this in solving a bigger problem of my routes not working in production (going to http rather than https domain). Solving this problem by changing the
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
to
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies = "*";
solved both problems!
Please or to participate in this conversation.