Rectangle 27 8

Yep, it worked! Using the style attribute inside the 'table' tag works perfectly... thanks, Raphael! I'm marking your post as an answer! :)

Guess I wouldn't mind if this were mentioned on the GitHub page. It's not exactly obvious that you are not allowed to use the CSS file for table borders (and possibly other things). (I know that the question wasn't specifically about the .css file, but I find that when you include border formatting for table elements in the .css file, it doesn't work either - moving to inline style does.) Cost me a couple of hours.

html - HTML2PDF doesn't recognize tables' sizes - Stack Overflow

html pdf yii html-table html2pdf
Rectangle 27 0

I have the same problem and I changed the page margins, especially on the right side

html - HTML2PDF doesn't recognize tables' sizes - Stack Overflow

html table pdf yii html2pdf
Rectangle 27 0

Do you have tried with "style" attribute? All examples on html2pdf wiki is with this attribute : http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:bookmark&s[]=td&s[]=width

Yep, it worked! Using the style attribute inside the 'table' tag works perfectly... thanks, Raphael! I'm marking your post as an answer! :)

html - HTML2PDF doesn't recognize tables' sizes - Stack Overflow

html table pdf yii html2pdf
Rectangle 27 0

<table align="left" width="100%" style="page-break-after:always; margin-top:25px; margin-left:25px; font-family:tahoma; font-size:20px; ">
<tr><td>Your info</td></tr>
</table>

php - How to center absolutely positioned elements in css for a pdf - ...

php html css html2pdf
Rectangle 27 0

You can also use "col" tags after the opening "table" tag. e.g.

<col width="250">
<col width="500">
<col width="250">

html - HTML2PDF doesn't recognize tables' sizes - Stack Overflow

html pdf yii html-table html2pdf
Rectangle 27 0

Try to use DomPdf instead of html2pdf. It works great for me on creating invoices in PDF. But some treatments (positioning and font sizes) in your CSS code are needed. The screen content placed as it is didn't work as i expected. https://github.com/dompdf/dompdf

I did look at that before but couldn't figure it out. Doesn't seem to have any php examples or documentation... Do you think you could give an example of how to do the equivalent of what I have above with DomPdf? Just take a string of html $htmlContent and output pdf (to file).

Converting HTML to PDF via PHP (install font for html2pdf) - Stack Ove...

php pdf fonts tcpdf html2pdf
Rectangle 27 0

I have the same problem and I changed the page margins, especially on the right side

html - HTML2PDF doesn't recognize tables' sizes - Stack Overflow

html pdf yii html-table html2pdf