sugardaddy
sugardaddy

Reputation: 443

Need Thin Table Borders in PDF Generated by cfDocument

I'm using border-collapse (CSS) to make thin borders on my table. They render fine on the screen, but when they are sent into a PDF, via cfDocument, they end up as thicker grey borders.

I read that cfDocument doesn't support border-collapse yet, so what's my best option?

ColdFusion 9

Upvotes: 7

Views: 18326

Answers (7)

helles 977
helles 977

Reputation: 9

border-bottom: 0.4pt solid #ccc;

Upvotes: -2

eastweb
eastweb

Reputation: 21

I decided to see if CFDOCUMENT would understand old-school HTML since the solution above varied by browser. It's not ideal, but if you need to make it work, this might help:

<table cellpadding="1" cellspacing="1" bgcolor="black">
    <tr>
        <td bgcolor="white">Data</td>
        <td bgcolor="white">Data</td>
    </tr>
    <tr>
        <td bgcolor="white">Data</td>
        <td bgcolor="white">Data</td>
    </tr>
    <tr>
        <td bgcolor="white">Data</td>
        <td bgcolor="white">Data</td>
    </tr>
</table>

Upvotes: 2

Ronald Ziembinski
Ronald Ziembinski

Reputation: 1

Report builder is only useful when you want to quickly create an interactive tabular type report that allows the user to UN-collapse a row to get more data details that would be child to the parent row of focus.

I have to say I found this pretty useful and very close to what SSRS offers. But doesn't really help when it comes to exporting to pdf or excel.

Upvotes: -1

gordon
gordon

Reputation: 1182

Tables are so 90's but this does seem to work for cfdocument pdf (inconsistent on web browser display though):

.tbl {background-color:#000;}
.tbl td,th,caption{background-color:#fff}

...

<table cellspacing="1" class="tbl">
...
</table>

(border-spacing in style setting doesn't work - you have to put the attr in the table tag)

Upvotes: 5

Jake Feasel
Jake Feasel

Reputation: 16955

I've had the same issue with borders in cfdocument. Here are some tricks I learned:

Rather than setting your CSS like this:

table td {
  border: solid thin black;
}

Try this:

table, table td {
  border: solid black;
}
table {
  border-width: 1px 1px 0 0;
}
table td {
  border-width: 0 0 1px 1px;
}

This explicitly makes the width as small as possible. Also, it avoids the problem of "doubling" the widths that would occur due to each cell having their own 1px border and then having them sit adjacent to each other (so between the cells, you would in effect have a 2px border).

Also, you can reduce your "scale" value to the cfdocument tag to reduce the size of everything, including the thickness of your borders.

Upvotes: 3

Dale Fraser
Dale Fraser

Reputation: 4758

I'd recommend report builder, it will give you fine grain pixel level control and paging.

Upvotes: 1

SpliFF
SpliFF

Reputation: 38966

cfdocument has many limitations. if you're looking for css3 support, javascript etc I recommend wkhtmltopdf. It uses webkit to generate the PDF so it supports most of what Safari/Chrome supports.

Upvotes: 2

Related Questions