HTML2PDF Table content is overflowing out of page
<p>I am using HTML2PDF library and I am getting an issue while I am trying to to output my pdf. Actually, my table is always truncated, unable to display the whole content of my table without having it cut.
I defined css style, but it seems having to effect.Moreover, If I don't defined into my php script on echo statement table border="1px" it doesn't take style css defined previously.</p>

<p>Here my code:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Test PDF&lt;/test&gt;
&lt;style&gt;
table{width:100%; border-collapse:collapse; table-layout:auto; vertical-align:top; margin-bottom:15px; border:1px solid #CCCCCC;}
table thead th{font-size: 2px; color:#FFFFFF; background-color:#666666; border:1px solid #CCCCCC; border-collapse:collapse; text-align:center; table-layout:auto; vertical-align:middle;}
table tbody td{vertical-align:top; border-collapse:collapse; border-left:1px solid #CCCCCC; border-right:1px solid #CCCCCC; font-size: 2px;}
table thead th, table tbody td{padding:5px; border-collapse:collapse;}
table tbody tr.light{color:#979797; background-color:#F7F7F7;}
table tbody tr.dark{color:#979797; background-color:#E8E8E8;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;html&gt;
&lt;?php
require_once "config.php";

//Start html2pdpf session
ob_start();
//Get tablename
$tablename=$_POST["tablename"];
$ShowPivotTableResult='SELECT * FROM '.$tablename.'';
    $resultLeast=mysqli_query($conn,$ShowPivotTableResult) or die(mysqli_error($conn));
if (!$resultLeast) {
    die("Query to show fields from table failed");
    }
//Display Pivot Table content - script
$fields_num = mysqli_num_fields($resultLeast);
    echo "&lt;table border='1px' CELLSPACING='0' cellpadding='2'&gt;&lt;thead&gt;&lt;tr&gt;";
    // printing table headers
for($i=0; $i&lt;$fields_num; $i++)
{
    $field = mysqli_fetch_fields($resultLeast);
    echo '&lt;th&gt;'.$field[$i]-&gt;name.'&lt;/th&gt;';
}
echo "&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;\n";
// printing table rows
while($rowLEAST = mysqli_fetch_row($resultLeast))
{
    echo "&lt;tr&gt;";
    // $row is array... foreach( .. ) puts every element
    // of $row to $cell variable
    foreach($rowLEAST as $cellPIVOT)
    echo "&lt;td&gt;$cellPIVOT&lt;/td&gt;";
    echo "&lt;/tr&gt;\n";
    }
    echo '&lt;/tbody&gt;&lt;/table&gt;&lt;br/&gt;&lt;br/&gt;';

$content = ob_get_clean();

    // convert
    require_once('html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('L', 'A4', 'fr', true, 'UTF-8', 0);
        $html2pdf-&gt;pdf-&gt;SetDisplayMode('fullpage');
        $html2pdf-&gt;writeHTML($content, isset($_GET['vuehtml']));
        ob_end_clean();
        $html2pdf-&gt;Output(''.$tablename.'.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

mysqli_close($conn);
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>