<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
//ini_set('allow_url_fopen', 1);
ini_set('memory_limit','-1');
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('Asia/Kolkata');
$data=date("Y-m-dH-i-s"); 
//require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
use Dompdf\Options;

require __DIR__ . "/vendor/autoload.php";

$options = new Options();
$options->set('isRemoteEnabled', TRUE);
$options->set('tempDir', '/tmp');
$options->set('chroot', __DIR__);

$dompdf = new Dompdf($options);
;
$html=$_POST['pdf_data'];

$dompdf->setPaper('A3', 'portrait');

$dompdf->load_html($html);
$dompdf->render();
//$dompdf->stream("mgr.pdf", array('Attachment'=>'0'));
 $pdf_string =   $dompdf->output();
file_put_contents("downloads/".$data."pdf1.pdf", $pdf_string); 
echo $data."pdf1.pdf";

exit();
?>