Gerando arquivo PDF a partir do php
<?php
require_once("dompdf/dompdf_config.inc.php");/ Carrega a classe DOMPdf /
$dompdf = new DOMPDF();/ Cria a instância /
$dompdf->load_html('<!doctype html>/ Carrega seu HTML /
<html>
<head>
<meta charset="UTF-8">
<title>Atenção, apenas um teste</title>
<style>* { font-family: sans-serif; }
</style>
</head>
<body>
$nome = $_POST['nome']
$nome = $_POST['nome']
<table>
<tr>
<td>Nome</td>
<td>$nome</td>
</tr>
<tr>
<td>Idade</td>
<td>$idade</td>
</tr>
</table>
</body>
</html>');
/ Renderiza /
$dompdf->render();
/ Exibe /
$dompdf->stream(
"saida.pdf", / Nome do arquivo de saída /
array(
"Attachment" => false /* Para download, altere para true */
)
);
?>Discussão (1)
Carregando comentários...