Table borders in Pisa
Asked Answered
I

5

5

I'm trying to have table borders in my PDF using pisa to generate the PDF from my html page. According to the documentation, I should use CSS to display borders in my table. However this is not working out. I can see the borders on my webpage, but on the generated PDF there's absent. Is there something I'm missing or doing wrong? I'm using the following styles for the table:

table { border: 1px solid #666666;  border-collapse:collapse; border-color:#ccc; }
td, th { border: 1px solid #666666; font-size:11px; line-height:13px; border-bottom:1px solid #666666; vertical-align:top; padding:5px; font-family:"Lucida Grande", Verdana, Arial, sans-serif; }
Interference answered 11/9, 2009 at 19:39 Comment(0)
I
6

I forgot to update this question after I got the answer....the CSS should be in the HTML page that'll be used by pisa. Apparently external CSS stylesheets don't work. Hope this will someday help someone else

Interference answered 5/10, 2009 at 8:6 Comment(2)
external stylesheet works, as it's explained below. The problem then is to know which kinds of CSS statements are supported, you'll find them in the docs. border-collapse is not one of them.Ratio
External stylesheets do work, but it's not always easy to tell if it's finding them correctly.Gerrygerrymander
H
3

Just to correct this - external css does work in PISA but you need to ensure it can locate the css at render time. See django - pisa : adding images to PDF output for more infor on how to do this.

Regards

Tim

Hardan answered 17/9, 2011 at 20:8 Comment(0)
J
3

For me, it worked if i assigned a class for it. for example to draw a border around the cell, use below css class:

td.box{
    border: 1px solid #666666;
}

in td, add the class:

<td class="box"> Something </td>
Joke answered 7/4, 2018 at 18:30 Comment(0)
A
2

I had the same problem.

the solution was: 1 - CSS should be in the HTML page, 2 - CSS should be out of @page attribute.

Avner answered 4/11, 2010 at 16:59 Comment(0)
D
2

Setting display:block for <table> and <td> elements solved this problem for me.

Deconsecrate answered 22/10, 2011 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.