Viewing file: test_pdf.php (4.07 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//index.php
//include autoloader
require_once 'dompdf/autoload.inc.php';
require "connection.php";
session_start();
if (isset($_SESSION['user_id']))
{
$u_id = $_SESSION['user_id'];
$uname = $_SESSION['user_name'];
} else {
$u_id = '';
$uname = '';
}
use Dompdf\Dompdf;
use Dompdf\Options;
$options = new Options();
//$options->set('defaultFont', 'roboto');
$options->set('isPhpEnabled', 'true');
$document = new Dompdf($options);
$resulthtml= '
<div class="wrapper_resume" style=" margin: 0 auto; max-width: 960px;" >
<div class="wrapper_Outer" style="width: 100%;border: solid 1px #ccc;float: left;margin: 30px 0;background: #FFF;" >
<div class="sidebar-wrapper" style=" background:#4c4a4a;float: left;width: 300px;height: 1200px;color: #fff;padding: 25px 0;" >
<div class="profileImg" style="width: 165px;height: 165px;margin: 0 auto;overflow: hidden;border-radius: 100%;border: 5px solid #FFF;" >
<img style="height: 165px;object-fit: cover;" src="profile_default.jpg">
</div>
<div class="contact-container container-block" style="margin-top: 15px;padding: 15px 20px; float: left;background:#4c4a4a;">
<h6 class="subtitles" style=" font-weight: 400;text-transform: uppercase;border-left: 15px solid #ff9800;float: left;width: 100%;padding: 7px 10px;font-size: 18px;letter-spacing: 0.2px;margin: 10px 0 15px;background: #65666d;" >Basic Details</h6>
<br>
<br><br><br>
<label >Email</label><br>
rahul.srishti@gmail.com<br>
<label >Phone</label><br>
7894561230<br>
<label >Date of Birth</label><br>
25/05/1991<br>
</div>
<div class="contact-container container-block" style="background:#4c4a4a;">
<h6 style="text-transform: uppercase;border-left: 15px solid #ff9800;font-size: 18px;letter-spacing: 0.2px;background: #65666d;width:190px;margin-top:-40px; " >Address </h6>
<br>
<span >
<label >Present Address</label><br>
4329 Cardinal Lane<br> Champaign<br> Illinois<br> 61820
</span>
<span >
<br>
Integer ullamcorper
4329 Cardinal Lane<br> Champaign<br> Illinois<br> 61820
</span>
</div>
</div>
<div class="main-wrapper" style=" background: red; padding: 0px;width: 330px;min-height: 100%;float: left;" >
test
</div>
<!--main-wrapper end-->
</div>
</div>
';
//echo $document->getOptions()->getChroot();
//die();
$document->loadHtml($resulthtml);
$document->set_base_path("/home4/srishtis/public_html/srishticampus/");
$document->setPaper('A4', 'portrait');
$document->render();
$sqlcheck=$con->query("select * from enrolldetails where user_id='$u_id' and admin_status=1");
if($sqlcheck->num_rows == 0){
// Instantiate canvas instance
$canvas = $document->getCanvas();
// Get height and width of page
$w = $canvas->get_width();
$h = $canvas->get_height();
// Specify watermark image
$imageURL = 'images/sicsfullogo.png';
$imgWidth = 300;
$imgHeight = 30;
// Set image opacity
$canvas->set_opacity(.2);
// Specify horizontal and vertical position
$x = (($w-$imgWidth)/2);
$y = (($h-$imgHeight)/2);
// Add an image to the pdf
$canvas->image($imageURL, $x, $y, $imgWidth, $imgHeight);
}
$document->stream("Srishti Campus" ,array("Attachment"=>0));
//echo $document->output();
//echo $resulthtml;
?>
|