Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

IsaacBen's avatar

DOMPDF max execution error on three paragraphs.

I have issues with the dompdf library. Is three medium paragraphs really that much for it to render? I'm trying to figure out if the problem is on my side. Here's a gist with my template https://gist.github.com/itzikbenh/3b598c70036f3ec2d131c2b1f1edd62a

How I render it

$invoice = (object) $request->all();
$pdf     = PDF::loadView('projectInvoice/show', compact('invoice'));
return $pdf->stream();
0 likes
1 reply
IsaacBen's avatar

Looks like dompdf is just not performant enough. I'm using Laravel Snappy and it's much better. In case anyone needs here's how I installed it in Ubuntu 16.04.1.

//Get package. See here for newest version - //http://wkhtmltopdf.org/downloads.html
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

sudo apt install wkhtmltopdf

//create symlink.
sudo ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf

//At this point you can run this command to test that everything works.
/usr/local/bin/wkhtmltopdf google.com google.pdf

//Command above will give you the following error - QXcbConnection: Could not connect to display Aborted (core dumped)
//This is due to a bug in the debian packages, or something like that :) 
//Solution taken from here - http://unix.stackexchange.com/questions/192642/wkhtmltopdf-qxcbconnection-could-not-connect-to-display
sudo apt install xvfb

//Now in the snappy config file change this
'binary'  => '/usr/local/bin/wkhtmltopdf',
//To
'binary'  => '/usr/bin/xvfb-run -- /usr/local/bin/wkhtmltopdf',

//It should work now.
2 likes

Please or to participate in this conversation.