pawelmysior
pawelmysior

Reputation: 3250

TCPDF grey background for few cells?

I'm using TCPDF in CakePHP and trying to make some background (grey) for few cells. Well here the idea:

alt text

so the grey thing would somehow have to be define outside of the cells containg text.

Any ideas?
Paul

Upvotes: 4

Views: 29775

Answers (4)

Lan Danel
Lan Danel

Reputation: 53

You can use the below code:

<td style="background-color:red;">
  Your Data...
</td>

Upvotes: -1

raf_qpsk
raf_qpsk

Reputation: 101

try this.

$this -> TCPDF -> SetFillColor(249,249,249); // Grey
$this -> TCPDF -> Cell(95,$cellHigh,$data,'L',0,'L',$fill,'',0,false,'T','C');

The TCPDF example No. 5 will give you different background colors.

Upvotes: 10

smentek
smentek

Reputation: 2884

Easiest way is to deliver your content as HTML with some simple formating included.

Check example 6 from TCPDF examples

Upvotes: 0

TCPDF has the habit of changing the background color to GREY when it comes across Tables in the HTML when generating the PDF.

The HTML will be usually having this background color tag for table.

background-color:transparent

whicih makes TCPDF to make it GREY. A simple fix would be just replacing the HTML content with whichever color you like. An example using PHP

$html = str_replace("background-color:transparent","background-color:white", $html);

Upvotes: 0

Related Questions