Viewing file: certificateprint.php (17.63 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $var = $_GET['ID']; $trimmed = trim($var); include 'connect.php';
$totalmarks = 0; $obtainedmarks = 0; $certificate_issue_date = ""; // initialize
$sql = "SELECT * FROM certificate WHERE CertificateNo='$trimmed'"; if ($result = mysqli_query($link, $sql)) { if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { $grades = $row['grade']; $certificate_no = $row['CertificateNo']; $enrollment = $row['enrollment'];
// format certificate issue date if (!empty($row['certifcate_issue_date'])) { $certificate_issue_date = date("d/m/Y", strtotime($row['certifcate_issue_date'])); }
$start_date = $row['start_date']; $end_date = $row['end_date'];
// Ensure all marks are numeric; default to 0 $pn1_total_marks = (int) ($row['pn1_total_marks'] ?? 0); $pn1_obtained_marks = (int) ($row['pn1_obtained_marks'] ?? 0);
$pn2_total_marks = (int) ($row['pn2_total_marks'] ?? 0); $pn2_obtained_marks = (int) ($row['pn2_obtained_marks'] ?? 0);
$pn3_total_marks = (int) ($row['pn3_total_marks'] ?? 0); $pn3_obtained_marks = (int) ($row['pn3_obtained_marks'] ?? 0);
$pn4_total_marks = (int) ($row['pn4_total_marks'] ?? 0); $pn4_obtained_marks = (int) ($row['pn4_obtained_marks'] ?? 0);
$pn5_total_marks = (int) ($row['pn5_total_marks'] ?? 0); $pn5_obtained_marks = (int) ($row['pn5_obtained_marks'] ?? 0);
$pn6_total_marks = (int) ($row['pn6_total_marks'] ?? 0); $pn6_obtained_marks = (int) ($row['pn6_obtained_marks'] ?? 0);
$pn7_total_marks = (int) ($row['pn7_total_marks'] ?? 0); $pn7_obtained_marks = (int) ($row['pn7_obtained_marks'] ?? 0);
// Sum up total and obtained marks $totalmarks += $pn1_total_marks + $pn2_total_marks + $pn3_total_marks + $pn4_total_marks + $pn5_total_marks + $pn6_total_marks + $pn7_total_marks;
$obtainedmarks += $pn1_obtained_marks + $pn2_obtained_marks + $pn3_obtained_marks + $pn4_obtained_marks + $pn5_obtained_marks + $pn6_obtained_marks + $pn7_obtained_marks; } mysqli_free_result($result); } } else { echo "ERROR: Could not execute $sql. " . mysqli_error($link); }
// Calculate percentage and assign grade $percentage = ($totalmarks > 0) ? round(($obtainedmarks / $totalmarks) * 100) : 0;
if ($percentage >= 90) { $grade = 'A+'; } elseif ($percentage >= 75) { $grade = 'A'; } elseif ($percentage >= 66) { $grade = 'B'; } elseif ($percentage >= 56) { $grade = 'C'; } elseif ($percentage >= 50) { $grade = 'D'; } else { $grade = 'F'; }
// Close connection mysqli_close($link); ?>
<?php include 'connect.php';
// Attempt select query execution $sql = "select * from admission where enrollment='$enrollment' "; if($result = mysqli_query($link, $sql)) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)) { $student_name=$row['name']; $Enrollment=$row['enrollment']; $father_name=$row['fatherName']; $branch='INFYSYS TECHNOLOGIES COMPUTER EDUCATION (SARAIMIR, AZAMGARH, UP India)'; $course=$row['course']; $subject=$row['subject'];
$qrcode='Roll No:-'.$Enrollment."\n".'Certificate No:-'.$certificate_no."\n".'Name:-'.$student_name."\n".'Father Name:-'.$father_name."\n".'Course:-'.$course."\n".'Grade:-'.$grades."\n".'Issue Date:-'.$certificate_issue_date;
$newqrcode="https://barcode.tec-it.com/barcode.ashx?data=".$qrcod; $studentphoto=$row['photo']; $newpohto='http://itce.co.in/data/files/'.str_replace(' ', '%20',$studentphoto); $count++ ; $scancode=$qrcode;
} // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?> <?php include 'connect.php';
// Attempt select query execution $sql = "select * from courses where course_name='$course' "; if($result = mysqli_query($link, $sql)) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)) { $course_name=$row['course_name']; $course_content=$row['certificate_course']; $month=$row['course_duration']; $count++ ; } // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script> <script> async function generatePdf() { const { jsPDF } = window.jspdf;
// Capture the specific HTML element by ID const element = document.getElementById("print-area");
// Use html2canvas to capture the element const canvas = await html2canvas(element, { scale: 2, // Increase scale for better quality useCORS: true // Allows cross-origin images });
// Convert canvas to image format const imgData = canvas.toDataURL("image/png");
// Create a new PDF with landscape orientation, A4 size const pdf = new jsPDF("landscape", "mm", "a4");
// Calculate dimensions to fit the content within A4 landscape const pageWidth = pdf.internal.pageSize.getWidth(); const pageHeight = pdf.internal.pageSize.getHeight(); const imgWidth = pageWidth; const imgHeight = (canvas.height * pageWidth) / canvas.width;
// Center the image vertically if it doesn't fill the page const yPos = (pageHeight - imgHeight) / 2;
// Add the captured image to the PDF at calculated dimensions pdf.addImage(imgData, "PNG", 0, yPos, imgWidth, imgHeight);
// Save the generated PDF pdf.save("Certificate.pdf"); } </script> </body> </html>
<!-- Button to trigger PDF generation --> <button onclick="generatePdf()">Generate PDF</button>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--page generated by WebAcappella--> <!-- 2023-01-09T12:20:07 ***************************--> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7;IE=EmulateIE9" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <meta name="generator" content="WebAcappella 4.6.9 ecommerce (WIN) #0"/> <title></title> <meta name="keywords" content=""/> <meta name="description" content=""/>
<style type="text/css"> body{margin-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;background-color:#ffffff;} </style> <link rel="stylesheet" type="text/css" href="wa_global_style.css"/> <script type="text/javascript" src="jquery.js?v=86c"></script> <script type="text/javascript"> var waJSQuery = jQuery.noConflict(); </script> <script type="text/javascript" src="webacappella_core.js?v=1ups"></script> <!--[if lte IE 8]><script type="text/javascript" src="excanvas.js?v=1f2a"></script> <![endif]--> <!--[if lte IE 8]><script type="text/javascript" src="webacappella_patch_ie8.js?v=tc5"></script> <![endif]--> <script type="text/javascript"> document.write("\u003cscript type='text/javascript' src='wa_site_global_settings.js?v=21xdlg2ykpn01y"+urlSuffixe(1)+"'>\u003c/script>"); </script> <script type="text/javascript" src="jquery.mousewheel.js?v=use"></script> <link href="webacappella.css?v=10nl" rel="stylesheet" type="text/css" media="all"/> <!--[if lte IE 7]> <link href="webacappella_ie.css?v=1tjn" rel="stylesheet" type="text/css" media="all"/> <![endif]--> <script type="text/javascript" src="webacappella_tools.js?v=blf"></script> <script type="text/javascript"> waJSQuery(function() { initializeWA_JQuery() }); </script> <script type="text/javascript"> var waWebFontDescription={families:[ ]} </script>
</div> </head>
<div id="print-area" style="border: 1px solid #ccc; padding: 0px; width: 975px; height:700px">
<div id="qrcode" class="wa-img wa-comp " style="position:absolute;z-index:10056;left:780px;top:160px;width:80px;height:80px;border:0px;"/></div>
<!-- Include the qrcode.min.js library --> <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script> <?php // Fetch the ID parameter from the URL $keywords = $scancode; ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script> <script> // Certificate information const data = `<?php echo $keywords ?>`;
// Generate QR code const qrcode = new QRCode(document.getElementById("qrcode"), { text: data, width: 90, // Width of the QR code height: 90, // Height of the QR code colorDark: "#000000", // Dark color colorLight: "#ffffff", // Light color correctLevel: QRCode.CorrectLevel.H // Error correction level }); </script>
<div id='wa-dialog-container' class='wa-fullscreen-contenair' style='position:absolute;z-index:52000;'></div><div id='html-centered' style='position:relative;width:100%;z-index:200;'><div id='is-global-layer' class='wa-main-page-contenair' style='position:relative;z-index:200;top:0px;width:1000px;;text-align:left;margin:0 auto; '><div style="position:absolute;top:1px;left:0px;width:1px;height:1px;"><a name="anchor-top"> </a></div>
<div style="position:absolute;z-index:10052;left:512px;top:515px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $certificate_issue_date ?></span></div></div></div><div style="position:absolute;z-index:10048;left:309px;top:514px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $end_date?></span></div></div></div><div style="position:absolute;z-index:10044;left:172px;top:513px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $start_date ?></span></div></div></div><div style="position:absolute;z-index:10040;left:520px;top:480px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $grades ?></span></div></div></div><div style="position:absolute;z-index:10036;left:214px;top:480px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $certificate_no ?></span></div></div></div><div style="position:absolute;z-index:10032;left:249px;top:400px;width:629px;height:80px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:627px;height:78px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $course_content ?></span></div></div></div><div style="position:absolute;z-index:10028;left:240px;top:366px;width:660px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:658px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $branch ?></span></div></div></div>
<div style="position:absolute;z-index:10024;left:254px;top:332px;width:550px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:566px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $course ?></span></div></div></div>
<div style="position:absolute;z-index:10020;left:129px;top:332px;width:520px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " >
<div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:69px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="center"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $month ?></span></div></div></div><div style="position:absolute;z-index:10016;left:300px;top:298px;width:472px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:470px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $father_name ?></span></div></div></div><div style="position:absolute;z-index:10012;left:352px;top:264px;width:520px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:518px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:bold;color:#000000;" ><?php echo $student_name ?></span></div></div></div><div style="position:absolute;z-index:10008;left:740px;top:74px;width:188px;height:20px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:186px;height:18px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $Enrollment ?></span></div></div></div><img src="<?php echo $newpohto ?>?v=25euuw2yjeiduq" alt="photo" title="photo" class="wa-img wa-comp " style="position:absolute;z-index:10004;left:689px;top:140px;width:82px;height:93px;border:0px solid #969696;-moz-border-radius:0px;border-radius:0px;-webkit-border-radius:0px;"/><img src="certificate/Annu_20Bhaskar.jpg?v=2sa44o2ykpn01z" alt="" class="wa-img wa-comp " style="position:absolute;z-index:10000;left:0px;top:9px;width:976px;height:691px;border:0px;"/><div style="position:absolute;top:679px;left:0px;width:1px;height:1px;" ><a name="anchor-bottom"> </a></div> <div id='dynmenu-container' style='position:absolute;z-index:51000;'></div></div> </div> </div> <!--end html-centered--> <script type="text/javascript"> <!-- document.webaca_page_option_background=0 document.webaca_page_background_img_size=[-1,-1] document.webaca_page_is_centered=true; document.webaca_width_page=1000; document.webaca_height_page=699; document.webaca_banner_height=0; document.webaca_is_preview=false; var wa_global_market = {markets:new Array(),id_modif_dlg_js:''}; Translator.m_lang="en"; Translator.m_languages={} Translator.m_lang_for_filename=""; function wa_timeout(_fct,_time,p1,p2,p3){return setTimeout(_fct,_time,p1,p2,p3)} function wa_evaluate(_s){return eval(_s)} function IS_onload(){ IS_onload_WA(); } --> </script> <script type="text/javascript" src='wa_common_messages_en.js?v='></script> <script type="text/javascript"> <!-- WA_loadMessages(); --> </script> <script type="text/javascript"> <!-- --> </script>
</body> </html>
|