Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost";
- $db_user="root";
- $db_password="";
- $dbname="test";
- $connect=mysql_connect($host,$db_user,$db_password) or die(mysql_error());
- $select_db=mysql_select_db($dbname);
- require_once('mpdf.php');
- ob_start();
- ?>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
- <style type="text/css">
- <!--
- @page rotated { size: portrait; }
- .style1 {
- font-family: "Times New roman";
- font-size: 18pt;
- font-weight: bold;
- }
- .style2 {
- font-family: "Times New roman";
- font-size: 16pt;
- font-weight: bold;
- }
- .style3 {
- font-family: "Times New roman";
- font-size: 16pt;
- }
- .style5 {cursor: hand; font-weight: normal; color: #000000;}
- .style9 {font-family: Tahoma; font-size: 12px; }
- .style11 {font-size: 12px}
- .style13 {font-size: 9}
- .style16 {font-size: 9; font-weight: bold; }
- .style17 {font-size: 12px; font-weight: bold; }
- -->
- </style>
- <!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">
- <html>
- <head>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
- </head>
- <body>
- <div class=Section2>
- <table width="704" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td width="291" align="center"><span class="style2">Heading1</span></td>
- </tr>
- <tr>
- <td height="27" align="center"><span class="style2">Heading2 </span></td>
- </tr>
- </table>
- <table width="200" border="0" align="center">
- <tbody>
- <tr>
- <td align="center"> </td>
- </tr>
- </tbody>
- </table>
- <table bordercolor="#424242" width="1141" height="78" border="1" align="center" cellpadding="0" cellspacing="0" class="style3">
- <tr align="center">
- <td width="44" height="23" align="center" bgcolor="#D5D5D5"><strong>aaa</strong></td>
- <td width="44" height="23" align="center" bgcolor="#D5D5D5"><strong>bbbb</strong></td>
- <td width="178" align="center" bgcolor="#D5D5D5"><strong>bbbbb</strong></td>
- <td width="123" align="center" bgcolor="#D5D5D5"><strong>vvvvvvvvv</strong></td>
- <td width="123" align="center" bgcolor="#D5D5D5"><strong>vvvvvvvvv</strong></td>
- </tr>
- <?php
- $objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database");
- $objDB = mysql_select_db("test");
- //mysql_query("set NAMES'UTF8'");
- $strSQL = "SELECT * FROM main_details";
- $objQuery = mysql_query($strSQL);
- $resultData = array();
- while($data = mysql_fetch_array($objQuery)){
- array_push($resultData,$data);
- ?>
- <tr>
- <td align="right" class="style3"><?php echo $result['$i'];?></td>
- <td align="right" class="style3"><?php echo $result['batch'];?></td>
- <td align="right" class="style3"><?php echo $result['center']; ?>
- <td align="right" class="style3"><?php echo $result['code']; ?></td>
- <td align="right" class="style3"><?php echo $result['created_at']; ?></td>
- </tr>
- <?php } ?>
- </table>
- <table width="200" border="0">
- <tbody>
- <tr>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>
- <?Php
- $html = ob_get_contents();
- ob_end_clean();
- $pdf = new mPDF('th', 'A4','0','');
- $pdf->SetAutoFont();
- $pdf->SetDisplayMode('fullpage');
- $pdf->WriteHTML($html, 2);
- $pdf->Output();
- ?>
Add Comment
Please, Sign In to add comment