mPDF - Inline blocks not displaying side by side

Kirk Logan picture Kirk Logan · May 31, 2015 · Viewed 9.8k times · Source

I have a bunch of small tables that are formatted as inline-block elements. In the browser they display side by side as intended, but when using mPDF to output 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 get elements to stack side-by-side?

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

Below is an example of the browser and pdf view.

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;
?>

Answer

JazMagno picture JazMagno · Mar 10, 2019

I try a lot of thinks too, but finally i found a solution, just use:

float: left;

Thats work for me.