MPDF - Inline blocks not displaying side by side

I have a bunch of small tables that are formatted as inline-block elements. In the browser they render side by side as intended, but when using mPDF to display them, they break after each table. No matter how I try to format them, they always break after the table. Is there a trick with mPDF to make the elements stack side by side?

I am pulling the exact HTML from the page and submitting it via AJAX

Below is an example of browser and PDF viewer.

HTML View

PDF View

My mPDF generator page looks like this:

<?php
include("mpdf60/mpdf.php");

$html = $_POST['html'];

$mpdf=new mPDF('utf-8', 'A4');
$mpdf->SetDisplayMode('fullpage');

// LOAD a stylesheet
$stylesheet = file_get_contents('../../_css/main.css');
$mpdf->WriteHTML($stylesheet,1);    // The parameter 1 tells that this is css/style only and no body/html/text

$mpdf->WriteHTML($html);
$mpdf->Output('myPDF.pdf','D');

exit;
?>

      

+3


source to share


1 answer


I spent a couple of hours figuring out how to create inline elements <div>

or <p>

using mPDF. I found limitations which has an inline block as well. display: inline

or display: inline-block

ignored. You have to put everything in elements <span>

if you want to see them next to another.



+2


source







All Articles