Craig Marvelley

Software and such

DOMPDF and the Mbstring Extension

I’ve been using DOMPDF for a while – it’s a great tool for converting HTML to PDF through PHP. I’ve been running it locally on several machines without issue, but I recently deployed it to a server running Centos 5.5 and was greeted with a blank page with no output every time I tried to generate a file. No errors on screen, no errors in the log file – and no way to step through the code.

After a painful couple of hours of old-school echo()-ing I noticed a call to one of the mb_* functions – PHP’s set of functions for dealing with multibyte strings. I don’t use that extension in my application, and DOMPDF doesn’t mention it in its installation notes along with its other dependencies, so I hadn’t thought I’d need it. A quick configure / make later though, and with the mbstring extension enabled PDFs were rendering quite happily.