Skip to content Skip to sidebar Skip to footer

HTML2PDF Table Content Is Overflowing Out Of Page

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

Solution 1:

Try to use absolute lengths on table width like pt. A4 has 595pt width. About css attribute, try to use class instead of the tag. example:

HTML

<style>
    .tbl{
     width: 595pt;
     border: 1px solid #000;
    }
</style>

PHP

echo "<table class='tbl' CELLSPACING='0' cellpadding='2'><thead><tr>";

Solution 2:

If you have specified table cell width in percentage, try to remove it and control the width using style attribute. The width should be in mm unit proportional to the page width.

E.g. if your page is A4 - portrait which is 595.276 wide. Your 50% width of table cell will take (595.276/2)-margins width in style attribute.


Post a Comment for "HTML2PDF Table Content Is Overflowing Out Of Page"