-2
I’m having some doubts regarding dompdf, I would like to know how to save the pdf file directly by the IDE without the need to use a browser, besides I would like to generate a loop to generate several independent pdfs, each with its specific information.
$dompdf = new DOMPDF();
$html = "<p>Este é um teste</p>";
$dompdf->loadHtml($html);
$papel = array(0, 0, 595.28, 841.89);
$dompdf->set_paper( 'A4', 'portrait');
$dompdf -> render();
$data_salvar = date_create();
$nome_arquivo = date_timestamp_get($data_salvar);
$nomeFinal = $nome_arquivo.".pdf";
$output = $dompdf->output();
$arquivo = "relatorios_gerados/".$nome_arquivo.".pdf";
if(file_put_contents($arquivo,$output) <> false) {
// Define o caminho onde será salvo
$dompdf->stream("C:\wamp64\www\geraDoc\DocumentosGerados", array ( "Attachment" => false ));
when run in the IDE I get the return
%PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /Procset 4 0 R /Font << /F1 8 0 R
/Mediabox [0.000 0.000 595.280 841.890]
endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer ( d o m p d f 1 . 0 . 2 + C P D F) /Creationdate (D:20210607065733+02'00') /Moddate (D:20210607065733+02'00')
endobj 6 0 obj << /Type /Page /Mediabox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R
endobj 7 0 obj << /Filter /Flatedecode /Length 77 >> stream x 2 300P@& ҹ B M -L L ,BR B 5 KR^ ! ! endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /Basefont /Times-Roman /Encoding /Winansiencoding
endobj xref 0 9 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000274 00000 n 0000000303 00000 n 0000000452 00000 n 0000000555 00000 n 0000000703 00000 n trailer << /Size 9 /Root 1 0 R /Info 5 0 R /ID[]
startxref 812 %%EOF
Please avoid long discussions in the comments; your talk was moved to the chat
– Guilherme Nascimento