Download Dompdf :
Example For Create PDF :
$html = ("<html>");
 $html .= ("<head>");
 $html .= ("<style>");
 $html .= ("</style>");
 $html .= ("</head>");
 $html .= ("<body>");
$html.=("<table width='500' border='1' cellspacing='1' cellpadding='1'>\n");
$html .= ("<tr>");
$html .= ("<td>hello</td>");
$html .= ("<td>welcome</td>");
$html .= ("</tr>");
 $html .= ("</table>");
 $html .= ("<h2>Generated PDF</h2>\n");
 $html .= ("<p>date_today</p>\n");
 $html .= ("</div>");
 $html .= ("<p>$table->COMMENT</p>\n");
 $html .= ("</body>");
 $html .= ("</html>");
 function render($html,$filename)
 {
  require_once("../dompdf_config.inc.php");
  $dompdf = new DOMPDF();
  $dompdf->load_html($html);
  $dompdf->set_paper("a4", "landscape" );
  $dompdf->render();
  $dompdf->stream("$filename.pdf");
 }
 $filename = ("GeneratedPDF");
 render($html,$filename);
}
  

thanks
ReplyDeleteHow can I to save the pdf?
ReplyDeleteok,
ReplyDeletejust replace this : $dompdf->stream("$filename.pdf");
With below line :
file_put_contents("foldername/$filename.pdf", $dompdf->output());
dompdf fail on large contents what will be the solution
ReplyDeletePlease set the "max execution time" in your page.so script not break if page content large data.
ReplyDeletePlease set "set_time_limit(0)" on top of the page.
hi., i have a problem i hope you help me, i'm mexican and my english is not very good but i'm going to try to explain the problem i have. i use dompdf to generate a report that retrieve data from mysql i store the path of the images and when a retrieve the data apear data(text) and the image but when i generate the pdf occur an error and the pdf is generated but i can´t open it , thanks
ReplyDeletehi., i have a problem i hope you help me, i'm mexican and my english is not very good but i'm going to try to explain the problem i have. i use dompdf to generate a report that retrieve data from mysql i store the path of the images and when a retrieve the data apear data(text) and the image but when i generate the pdf occur an error and the pdf is generated but i can´t open it , thanks
ReplyDeletehi., i have a problem i hope you help me, i'm mexican and my english is not very good but i'm going to try to explain the problem i have. i use dompdf to generate a report that retrieve data from mysql i store the path of the images and when a retrieve the data apear data(text) and the image but when i generate the pdf occur an error and the pdf is generated but i can´t open it , thanks
ReplyDeletehi., i have a problem i hope you help me, i'm mexican and my english is not very good but i'm going to try to explain the problem i have. i use dompdf to generate a report that retrieve data from mysql i store the path of the images and when a retrieve the data apear data(text) and the image but when i generate the pdf occur an error and the pdf is generated but i can´t open it , thanks
ReplyDelete