1

I have an html table which been generated by fpdf lib. I've tried align text in TD but i cant. Any of this options won't work: set inline align=center inline styles style="text-align: center;"

it looks something like that:

$html = "... do some html.."

then

$html .="<tr .....
foreach ( ...//
   $html .= "<td align="right... or style="text-align: right..

then:

$this->WriteHTML( $html );

Some attributes works, like bgcolor, but align, unfortunately - not. How can i align right text in my td items?

WebArtisan
  • 3,996
  • 10
  • 42
  • 62

1 Answers1

1

WriteHTML() is not a native function of FPDF, there are several WriteHTML Add-ons and as far as i know all of them are rather basic. They will understand simple HTML but not all tags or attributes.

If you want to convert HTML to PDF there are much better solutions like mPDF which is based on FPDF. (Only to name one of many...)

If you want to use FPDF and want a accurate PDF you have to use the native functions Write,Cell and so on. But in this case i would advise you to use tFPDF right from the start, it is the official UTF-8 Version of FPDF. FPDF utf-8 encoding (HOW-TO)

Community
  • 1
  • 1
Tarsis
  • 712
  • 6
  • 14