📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/2vinternational.com/admin/generate_pdf.php
<?php require("dbconnect.php"); require 'vendor/autoload.php'; use Dompdf\Dompdf; $id = $_GET['id']; // Fetch resume main info $resume = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM resumes WHERE id=$id")); // Fetch education $edu_query = mysqli_query($conn, "SELECT * FROM resume_education WHERE resume_id=$id"); $educations = []; while($row = mysqli_fetch_assoc($edu_query)){ $educations[] = $row; } // Fetch experience $exp_query = mysqli_query($conn, "SELECT * FROM resume_experience WHERE resume_id=$id"); $experiences = []; while($row = mysqli_fetch_assoc($exp_query)){ $experiences[] = $row; } // HTML design $html = " <html> <head> <style> body { font-family: DejaVu Sans, sans-serif; } .container { width: 100%; padding:15px; } .left { width: 30%; float:left; } .right { width: 65%; float:right; } h2 { margin:0; padding:0; } h3 { margin-top:20px; border-bottom:1px solid #aaa; padding-bottom:5px; } .section { margin-bottom:15px; } </style> </head> <body> <div class='container'> <div class='left'> <img src='".$resume['photo']."' width='150'><br><br> <b>Email:</b> ".$resume['email']."<br> <b>Phone:</b> ".$resume['phone']."<br> <b>Website:</b> ".$resume['website']."<br> <b>Address:</b> ".$resume['address']."<br><br> <h3>Expertise</h3> <p>".$resume['expertise']."</p> <h3>Languages</h3> <p>".$resume['languages']."</p> </div> <div class='right'> <h2>".$resume['full_name']."</h2> <h4>".$resume['job_title']."</h4> <p>".$resume['profile']."</p> <h3>Education</h3> <div class='section'>"; if(!empty($educations)){ foreach($educations as $edu){ $html .= "<p><b>".$edu['degree']."</b> - ".$edu['institute']." (".$edu['year'].")</p>"; } } else { $html .= "<p>No education records</p>"; } $html .= " </div> <h3>Work Experience</h3> <div class='section'>"; if(!empty($experiences)){ foreach($experiences as $exp){ $html .= "<p><b>".$exp['company']."</b> - ".$exp['position']." (".$exp['start_year']." - ".$exp['end_year'].")<br> ".$exp['description']."</p>"; } } else { $html .= "<p>No experience records</p>"; } $html .= " </div> <h3>References</h3> <p>".$resume['reference_info']."</p> </div> </div> </body> </html> "; $dompdf = new Dompdf(); $dompdf->loadHtml($html); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $dompdf->stream("resume.pdf", array("Attachment" => true)); ?>
Save
Cancel