<?php
$html ='<!DOCTYPE html>
<html>
<head>
</head>
<body>';
require_once 'F:\WEB/htdocs/sp/vendor/autoload.php';
$pdo = new PDO('mysql:host=localhost;dbname=dbsp', 'root', 'admin');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$consulta = $pdo->query("SELECT * FROM publicacoes;");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC))
{
$resultado[] = $linha;
}
$html .= '<div style="border: 1px solid; column-count: 2; width: 90%; margin-left: 5%">';
foreach ($resultado as $key => $value) {
$html .= "<p style='font-weight: bold ;width: 80%; margin-left: 10%'>
".$value['titulo']."
</p>
<p style='width: 80%; margin-left: 10%' align='justify'>
".nl2br($value['conteudo'])."
</p>
<br>";
//htmlspecialchars($value['conteudo'])
}
$html .= "</div>
</body>";
//define o caminho da folha de estilo
// $stylesheet = file_get_contents('../style/system.css');
$mpdf = new \Mpdf\Mpdf();
//coloca o estilo no html
// $mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html);
$mpdf->Output(); // Para ver em PDF
// echo $html; // Para ver em HTML
?>
When I give echo
, it shows two columns exactly as I want it, but when I call mPDF , it ignores CSS :
column-count: 2;
I want you to display two columns in PDF .