<?php
include('../helper/app2.php');
$admin = new admin;
$preview = $admin->pdfPreview();
$html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title> New Document </title><meta name="Generator" content="EditPlus"><meta name="Author" content=""><meta name="Keywords" content=""> <meta name="Description" content=""> <link href="../../css/style.css" rel="stylesheet" type="text/css" /></head><body><div class="biegeBox"><div class="cardContainer"><div class="cardImg" style="background-image:url(http://'.$_SERVER['SERVER_NAME'].'/demo/'. $preview[0]['image'].'); background-repeat:no-repeat;"><div class="cardQuote">'.$preview[0]['desc'].'</div></div></div></div></body></html>';
if ( isset( $html ) ) {
require_once("dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
$dompdf->render();
$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));
exit(0);
}
?>
The above code I am using to create pdf from dom, but its not rendering image in the pdf. Can any one help me to fix it. After reading this DOMPDF Page background (or alternatives?) question and answer I changed the background property.