Fatal error: Uncaught Error: Call to a member function build_tree () on null in /opt/lampp/htdocs/atm/dompdf/src/Dompdf.php:565 Stack trace:
0 /opt/lampp/htdocs/atm/dompdf/src/Dompdf.php(719): Dompdf \ Dompdf-> processHtml () # 1 /opt/lampp/htdocs/atm/pdf.php(106) :
Dompdf \ Dompdf-> render () # 2 {main} thrown in /opt/lampp/htdocs/atm/dompdf/src/Dompdf.php on line 565
This is the code of the page .. called to the Dompdf function ....
<?php
require_once('dompdf/autoload.inc.php');
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->set_option('isHtml5ParserEnabled', true);
//$dompdf->loadHtml();
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream("reporte");
This is the html page that should be generated as pdf ..
<?php
include ('conexion.php');
$id = $_GET['id'];
$consulta = mysqli_query($con,"SELECT * FROM contenido WHERE terminalid = '".$id."' ");
$row_query = mysqli_fetch_array($consulta);
//$row_query = $arreglo[$consulta];
//$workers=$array['workers'];
?>
<html>
<body>
<br>
<table style="width: 80% ; margin: auto" >
<tr>
<td style="width: 50%; text-align: left ; font-weight: bold;">
Great Country ATM <br>
66 John St. Warehouse <br>
Brooklyn, NY 11201
</td>
<td style="width: 50%; text-align: right ; font-weight: bold;">
Monthly Statement
</td>
</tr>
</table>
<br>
<br>
<table cellspacing="0" style="width: 80%; margin: auto ; text-align: left; font-size: 10pt;">
<tr>
<td style="width:45%; text-align: center; ">
<?php echo $row_query['dir1'] ?> <br><br>
<?php echo $row_query['dir2'] ?> <br><br>
<?php echo $row_query['dir3'] ?> <br><br>
</td>
<td style="width:10%; "></td>
<td style="width:45%; text-align: center;">
<?php echo $row_query['periodo'] ?> <br><br>
<?php echo $row_query['terminalid'] ?> <br>
</td>
</tr>
</table>
<table style="width: 80%; margin: auto;">
<tr style="width: 100%">
<td style="width: 25% ; text-align: center ; padding: 25px">fecha</td>
<td style="width: 25% ; text-align: center ; padding: 25px">surch</td>
<td style="width: 25% ; text-align: center ; padding: 25px">acc</td>
<td style="width: 25% ; text-align: center ; padding: 25px">valor</td>
</tr>
<?php foreach ($consulta as $valor) {
?>
<tr>
<td style="text-align: center ;"> <?php echo $valor['fecha']; ?> </td>
<td style="text-align: center ;"> <?php echo $valor['surch']; ?> </td>
<td style="text-align: center ;"> <?php echo $valor['acc']; ?> </td>
<td style="text-align: center ;"> <?php echo $valor['valor']; ?> </td>
</tr>
<?php } ?>
</table>
</body>
</html>