Please help... I want to convert my php html table populated with data coming from mysql table to pdf using tcpdf classes, but i don't know how to start, below is the excerpt code, that i want to convert in pdf. I want the php html table code below convert to pdf once i click the convert to pdf link. Please help me on how to do this.
Thanks.
<?php
ob_start();
if (!isset($_SESSION)) {
session_start();
}
require 'con/db.php';
$sem = isset($_GET['sms']) ? mysql_real_escape_string(htmlentities(trim($_GET['sms']))) : "";
$sy = isset($_GET['syr']) ? mysql_real_escape_string(htmlentities(trim($_GET['syr']))) : "";
$sqlGetStud = @mysql_query("SELECT student.STUDENTNUM,student.FNAME, student.MNAME, student.LNAME,student.GENDER FROM student
INNER JOIN registration ON student.STUDENTNUM=registration.STUDENTNUM
WHERE registration.SEMESTER='$sem' AND registration.SY='$sy' ORDER BY student.LNAME,student.FNAME");
echo '<table width=75%>';
echo '<table border=1 width=95%>';
echo '<tr><td ><center><b>Name of Students</b></center><td ><center><b>ID NO.</b></center></td>';
while($rs = mysql_fetch_array($sqlGetStud)){
$name = $rs['LNAME'].',' .' ' .$rs['FNAME'] .' ' .$rs['MNAME'];
echo '<tr border=1><td>'.$name .'<td>'.$rs['STUDENTNUM'].'</td></tr>';
}
</table>
?>
Problem Convert HTML table to pdf using tcpdf
Moderator: General Moderators
-
totoylubacon
- Forum Newbie
- Posts: 7
- Joined: Thu Mar 01, 2012 5:48 am
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Problem Convert HTML table to pdf using tcpdf
http://bg2.php.net/manual/en/pdf.examples-basic.php
^ the php manual entry about creating pdfs and below (if you haven't found it already) the examples page of tcpdf
http://www.tcpdf.org/examples.php
^ the php manual entry about creating pdfs and below (if you haven't found it already) the examples page of tcpdf
http://www.tcpdf.org/examples.php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Problem Convert HTML table to pdf using tcpdf
Check out dompdf. It coverts any HTML to pdf and can apply most CSS rules. I've used it on many projects including tables with variable width columns--even 30 columns wide. It works really well.