1
I have a certificate generator that are implemented with HTML/PHP
I used DOMPDF but it does not assign the variable $html=' <codigo todo> ';
it gives error in IF’s commands after I assign the variable. Same shows in the documentations and various tutorials on the internet, mine gives the error:
Parse error: syntax error, Unexpected T_CONSTANT_ENCAPSED_STRING in /usr/local/www/Apache24/data/applications/declaraca2/certificate/105/certificate.php on line 265
On that line contains: a IF = if ($obj->id=='81'){?>
I used the buffer ob_start;
it works, but it gets too off the page, I need to adjust it. But it has some certificates that appear the message:
Fatal error: Call to a Member Function get_cellmap() on a non-object in /usr/local/www/Apache24/data/applications/declaraca2/certificate/100/dompdf/include/table_cell_frame_reflower.cls.php on line 30
I tried MPDF too, but it only makes the background image and the fields of the certified data do not appear.
What to do?
Code of certificado.php
:
require_once("dompdf/dompdf_config.inc.php");
ob_start();
if ($obj->cpf == $doc) //isset($certificado_numero) and ($certificado_numero<>''))
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="unidade.css" rel="stylesheet" type="text/css">
<style type="text/css">
}
</style>
</head>
<body>
<table width="1070" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<div class="anterior">
<td width="1068" style="border-bottom: 0px solid #666666;" align="center">
<img src="<?= $imagem; ?>" width="1070" height="698" /></td>
</div>
</tr>
</table>
<div id='posiciona1'><?= utf8_decode($participante)?></div>
<div id='posiciona2'><b><?=$obj->num_certificado?></b></div>
<div id='posiciona4'><b><?= $horario; ?></b></div>
<div id='posiciona5'><? echo $observacoes."<p>"; ?></div>
</body>
<?
}
else
{
?>
<script type="text/javascript">
alert( 'Este Certificado ainda n�o foi registrado. Aguarde!');
self.close();
</script>
<?
}
?>
</html>
<?php
$html = ob_get_contents();
ob_end_clean();
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('a4', 'landscape');
$dompdf->render();
$dompdf->stream("newfile.pdf");
?>