<?php
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;

$contx="
		<head>
		<style>
		
		body{font-family:DejaVu Sans;font-size:12px}
		table{border-collapse:collapse;}
		td
		{
			vertical-align:top;
			padding: 2px 4px 2px 4px;
			
		}
		label {display:inline-block!important;width:200px!important;}
		.car-pic-sm{display:none}
		a{font-size:12px!important}
		@media print {
		  .noprint {display:none!important;}
		}
		img{width:400px}
		</style>
		</head>";

$contx .=$_POST["contx"];
$docname =$_POST["docname"];
$html =stripslashes($contx);


// instantiate and use the dompdf class
$dompdf = new Dompdf(array('enable_remote' => true,'defaultMediaType' => 'print'));
$dompdf->setbasepath(realpath('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/'));
// (Optional) Setup the paper size and orientation
//$dompdf->setPaper('A4', 'landscape');
$dompdf->set_option('defaultMediaType', 'print');
$dompdf->loadHtml($html);

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream($docname, array("Attachment" => false));

/*
$content="
		<head>
		<style>
		body{font-family:DejaVu Sans;font-size:12px}
		table{border-collapse:collapse;}
		td
		{
			vertical-align:top;
			padding: 2px 4px 2px 4px;
			
		}
		
		</style>
		</head>";

$content .=$_POST["content"];
$docname =$_POST["docname"];

//echo $content;exit;
$html =stripslashes($content);
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream($docname, array("Attachment" => false));
*/
?>
