<?php

require_once '../../resources/base_path_include.php';

require_once $base_path_to_learning_resources . "includes/config.php"; // use require for mandatory files
require_once $base_path_to_learning_resources . 'lib/function.php';

require_once $base_path_to_learning."vendor/autoload.php";

use \Spipu\Html2Pdf\Html2Pdf;
use \Spipu\Html2Pdf\Exception\Html2PdfException;
use \Spipu\Html2Pdf\Exception\ExceptionFormatter;



try {
    ob_start();
    $html = ob_get_clean();
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->pdf->SetDisplayMode('fullpage');
    $html2pdf->setDefaultFont('Arial');
    $html2pdf->pdf->SetTitle('Student Registration');
    
    $html=' 
    <style type="text/css">
      * {
        margin: 0;
        padding: 0;
        text-indent: 0;
      }

      table,
      tbody {
        vertical-align: top;
        overflow: visible;
      }
    </style>
 
  <body>
    <div style="width:800px;margin:0px auto;border:2px solid #ddd">
      <p style="padding-left: 471pt;text-indent: 0pt;text-align: left;" />
      <p style="text-indent: 0pt;text-align: left;">
        <span>
          <table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>
                <img width="90" height="61" src="E:\school.png" style="padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;margin-top:40px;    margin-left: 48px;" />
              </td>
              <td width="100%">
                <h1 style="padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;margin-top:30px;font-size:16;">Complex Academic 
                </h1>
                <h5 style="padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;margin-top:30px;padding:0px;margin:0px;font-size:16;">Another Way to Education</h5>
                <h1 style="padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;margin-top:30px;padding:0px;font-size:16px;margin:0px;padding-top:10px;font-weight:400">EDUCATION & IT TRAINING ACADEMY </h1>
              </td>
              <td style="">
                <img width="100" height="61" src="E:\school.png" style="height:80px;border:3px solid #ddd;margin-right:20px;padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;margin-top:30px" />
              </td>
            </tr>
            <tr>
              <td></td>
            </tr>
          </table>
        </span>
      </p>
      <h3 style="padding-top: 2pt;text-indent: 0pt;line-height: 110%;text-align: center;">Admission Form</h3>
	  <h3 style="text-align:center">Admission Number: <span><strong>123456</strong>,Registration Number: <span><strong>123456</strong></h3>
      <hr / style="border:1px solid #ddd;margin:3px;">
      <p style="text-indent: 0pt;text-align: left;" />
      <p style="padding-left: 5pt;text-indent: 0pt;text-align: left;" />
      <p style="text-indent: 0pt;text-align: left;">
        <br />
      </p>
      <div style="padding:20px">
        <table style="width:100%;" cellpadding="20" cellspacing="10" border=0>
         
		  <tr><td colspan="2"><h3>Personal Details</h3></td></tr>
          <tr>
            <td style="width:120px">Student Name:</td>
            <td style="width:245px">
              '.$name.'
            </td>
			 <td>Father Name: </td>
            <td>
              '.$fathername.'
            </td>
          </tr>
         
          <tr>
		   <td style="width:120px">Mother Name: </td>
            <td>
              '.$mothername.'
            </td>
            <td style="width:120px">Mobile: </td>
            <td>
                '.$mobile.'
            </td>
          </tr>
          <tr>
            <td style="width:120px">Email: </td>
            <td>
				  '.$email.'	
            </td>
			<td style="width:120px">Address:</td>
            <td>
                '.$address.'
            </td>
          </tr>
         
          <tr>
            <td style="width:120px"> City: </td>
            <td>
               '.$city.'
            </td>
			<td style="width:120px"> Pin Code: </td>
            <td>
               '.$pincode.'
            </td>
          </tr>
         
          <tr>
            <td style="width:120px"> Date Of Birth: </td>
            <td>
                '.$dob.'
            </td>
			<td style="width:120px">Gender:</td>
            <td>
               '.$gender.'
            </td>
          </tr>
         <tr><td colspan="2"><h3>Education Details</h3></td></tr>
		 <tr>
            <td style="width:120px"> Last School: </td>
            <td>
                '.$last_school.'
            </td>
			<td style="width:120px">Current Class: </td>
            <td>
                '.$current_class.'
            </td>
          </tr>
		  
		   <tr><td colspan="2"><h3>Other Details</h3></td></tr>
		 <tr>
            <td style="width:120px"> Nationality: </td>
            <td>
                '.$nationality.'
            </td>
			<td style="width:120px"> Caste: </td>
            <td>
                '.$caste.'
            </td>
          </tr>
		   <tr>
            <td style="width:120px"> Birth Certificate: </td>
            <td>
                '.$birth_certificate.'
            </td>
			<td> Nationality Proof (Adhar Card or Other Documents): </td>
            <td>
                '.$nationality_proof.'
            </td>
          </tr>
		   <tr>
            <td style="width:120px"> Nationality Proof Number: </td>
            <td>
                '.$nationality_proof_number.'
            </td>
			<td style="width:120px"> Class: </td>
            <td>
              '.$class.'
            </td>
          </tr>
		 
        </table>
      </div>
    </div>
    <p style="text-indent: 0pt;text-align: left;">
      <br />
    </p>
';
    
    $html2pdf->WriteHTML($html); // in $content you put your content to have in pdf


    //$html2pdf->Output('output.pdf');
    $html2pdf->Output('student.pdf');
    } catch (Html2PdfException $e) {
    $html2pdf->clean();
    $formatter = new ExceptionFormatter($e);
    echo $formatter->getHtmlMessage();
}


