Why doesn't border-collapse work in html2pdf?
I found a workaround, if I replace the css property border-collapse: collapse;
by cellspacing="0"
the result looks OK.
<table cellspacing="0" style="width: 100%; border:2px solid;position: relative;">
border-collapse: collapse;
is supposed to merge two of the same, adjacent borders together. When using it in html2pdf, you should style both the border-left
and border-right
attributes (as the same thing), which when collapsed will produce a single border. Also, to write this CSS defensively, and not assume the border-color
attribute inheritance, you should technically specify it when defining border, such as border: 1px solid black;