﻿<?php
//require_once("pdf/autoload.php"); 
 
ini_set('max_execution_time', '300');
require_once __DIR__ . '/pdf/autoload.php';
//require_once __DIR__ . '/pdf/paragonie/random_compat/psalm-autoload.php';
$mpdf = new \Mpdf\Mpdf([
  'mode' => 'utf-8',
 'format' => 'A3',
 'margin_left'=>'10',
 'margin_right'=>'10',
 'margin_top'=>'20',
 'margin_bottom'=>'20',
 'orientation' => 'P',
 'tempDir' => __DIR__ . '/tmp', // uses the current directory's parent "tmp" subfolder
 

]);

//$mpdf = new mPDF([
 //  'mode' => 'utf-8',
//   'format' => 'A4'
//]); 
//$mpdf = m_pdf->load([
 //  'mode' => 'utf-8',
 //  'format' => 'A4'
//]);

if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
	$dt=$_GET["dt"];
	
	
	if($dt)
	{
		$url="https://scoreman.in/keraladistricts2023/helmeta3.php?dt=".$dt;
//$url="http://localhost/skaterbase20/thank%20you.html";
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n")); 
//Basically adding headers to the request
$context = stream_context_create($opts);
$html = file_get_contents($url,false,$context);

//$mpdf->SetTitle($appno.' - RSFI ANNUAL REGN 2020-21');
	//	$html = file_get_contents($url);

	//	echo $html;
$mpdf->WriteHTML($html);
$mpdf->Output($dt.' - HELMETSTICKER A3 SIZE.pdf',\Mpdf\Output\Destination::DOWNLOAD);


$mpdf->Output();
}

}






?>