Peter
Peter

Reputation: 1021

Table border shown in wkhtmltopdf

I use WKHTMLTOPDF to generate a pdf. On my page, I have a table with no border. In the browser everything is fine. Example of table:

<table class="noborder" border="0">
    <tbody>
        <tr class="noborder">
            <th colspan="2" class="noborder">MyHeader</th>
         </tr>
     </tbody>
</table>

CSS: Noborder:

.noborder {
    border: 0px solid black;
}

But in the generated PDF there are the borders.

Upvotes: 4

Views: 5091

Answers (2)

Nikolay Mihaylov
Nikolay Mihaylov

Reputation: 3884

I know its a late answer, but none of the above worked for me. Only some of the table cells required a border by design, so adding transparent border to all cells fixed it.

.c-info-table td,
.c-info-table th{
    padding: 5px 10px;
    border: 1px solid transparent;
}
.c-info-table tbody tr:nth-child(odd) td{
    background-color: #ecf2f6;
}

before / after

Upvotes: 0

LeninGF
LeninGF

Reputation: 370

I am having the exact same problem. In browser everything renders ok. But when I render in pdf, borders appear in all tables. I had to use tables because wkhtml and pdfkit were not able to interpret div class row and div class col; consequently text never appeared as desired in the pdf.

However this seems to work:

td {
    border-style : hidden!important;
   }

This was reported: Removing unwanted table cell borders with CSS

Upvotes: 7

Related Questions