Cover image for I made a PDF Version of my Color Pages

I made a PDF Version of my Color Pages

azettl profile image Andreas ・1 min read

I played a little bit with mPDF and now all the color pages on my website offer amazing looking PDFs to download.

Next to the social share buttons for Facebook and Twitter you can find the new PDF export.

Most of the time I spend working around CSS limitations of mPDF like that they do not support pseudo elements.

The rest is pretty easy, just create a new mPDF instance, add a page, write the HTML and print the result.

$mpdf = new \Mpdf\Mpdf([
    'format' => 'A5',

/* Add a additional stylesheet */
$mpdf->WriteHTML('<h1>Hello dev.to</h1>');

Some Screenshots

Sample Links



markdown guide