Styles Css to tcpdf

0

I am generating a PDF file with TCPDF and I can not find a way to style the text using CSS. Can somebody help me?

Here's my code:

$pdf=new TCPDF();

$pdf->Addpage();

$pdf->SetFont('dejavusans', 'B', 20);

$pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);

// create some HTML content

$html="<h2>Recibo </h2>";

$html.="Buenos Aires, 12 de Diciembre de 2017. ";
$html.="Recibimos de el Sr. NOMBRE con DNI XXXXXXXX, estado civil XXXXXX, con domicilio en XXXXX, XXXXX
XXXXXXX, la suma de XXXXXx.- (XXXXXX 00/100 ), en concepto de Cuota, de acuerdo a las condiciones
que constan en el Boleto de Adhesión al Fideicomiso.";




<?php
$pdf->Ln();


// set core font
$pdf->SetFont('helvetica', '', 10);

// output the HTML content

$pdf->Ln();
// set UTF-8 Unicode font
$pdf->SetFont('dejavusans', '', 10);

// output the HTML content
$pdf->writeHTML($html, true, 0, true, true);

// reset pointer to the last page
$pdf->lastPage();

// ---------------------------------------------------------

//Close and output PDF document
$pdf->Output('Recibo.pdf', 'I');
?>
    
asked by José Miguel Viña 12.12.2017 в 18:49
source

1 answer

0

As far as I know, TCPDF does not support many css tags. On the other hand FPDF if you accept more CSS styles such as text color, background color, letter type (TCPDF too). It also allows you to play with the positions of each element where you want to place it. Here is an example I made.

Another option you have is to use Dompdf personally I do not know much about it, but you can see that you can do a lot with it.

I hope I have helped you.

    
answered by 12.12.2017 в 19:37