Guest User

Untitled

a guest
Nov 26th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. <?php
  2. $host="localhost";
  3. $db_user="root";
  4. $db_password="";
  5. $dbname="test";
  6.  
  7.  
  8. $connect=mysql_connect($host,$db_user,$db_password) or die(mysql_error());
  9. $select_db=mysql_select_db($dbname);
  10. require_once('mpdf.php');
  11. ob_start();
  12. ?>
  13. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
  14.  
  15. <style type="text/css">
  16. <!--
  17. @page rotated { size: portrait; }
  18. .style1 {
  19. font-family: "Times New roman";
  20. font-size: 18pt;
  21. font-weight: bold;
  22. }
  23. .style2 {
  24. font-family: "Times New roman";
  25. font-size: 16pt;
  26. font-weight: bold;
  27. }
  28. .style3 {
  29. font-family: "Times New roman";
  30. font-size: 16pt;
  31.  
  32. }
  33. .style5 {cursor: hand; font-weight: normal; color: #000000;}
  34. .style9 {font-family: Tahoma; font-size: 12px; }
  35. .style11 {font-size: 12px}
  36. .style13 {font-size: 9}
  37. .style16 {font-size: 9; font-weight: bold; }
  38. .style17 {font-size: 12px; font-weight: bold; }
  39. -->
  40. </style>
  41. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  42. <html xmlns="http://www.w3.org/1999/xhtml">
  43. <html>
  44. <head>
  45. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
  46. </head>
  47. <body>
  48. <div class=Section2>
  49. <table width="704" border="0" align="center" cellpadding="0" cellspacing="0">
  50. <tr>
  51. <td width="291" align="center"><span class="style2">Heading1</span></td>
  52.  
  53. </tr>
  54. <tr>
  55. <td height="27" align="center"><span class="style2">Heading2 </span></td>
  56. </tr>
  57.  
  58. </table>
  59. <table width="200" border="0" align="center">
  60. <tbody>
  61. <tr>
  62. <td align="center">&nbsp;</td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. <table bordercolor="#424242" width="1141" height="78" border="1" align="center" cellpadding="0" cellspacing="0" class="style3">
  67. <tr align="center">
  68. <td width="44" height="23" align="center" bgcolor="#D5D5D5"><strong>aaa</strong></td>
  69. <td width="44" height="23" align="center" bgcolor="#D5D5D5"><strong>bbbb</strong></td>
  70. <td width="178" align="center" bgcolor="#D5D5D5"><strong>bbbbb</strong></td>
  71. <td width="123" align="center" bgcolor="#D5D5D5"><strong>vvvvvvvvv</strong></td>
  72. <td width="123" align="center" bgcolor="#D5D5D5"><strong>vvvvvvvvv</strong></td>
  73.  
  74. </tr>
  75.  
  76. <?php
  77. $objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database");
  78. $objDB = mysql_select_db("test");
  79. //mysql_query("set NAMES'UTF8'");
  80. $strSQL = "SELECT * FROM main_details";
  81. $objQuery = mysql_query($strSQL);
  82. $resultData = array();
  83. while($data = mysql_fetch_array($objQuery)){
  84. array_push($resultData,$data);
  85. ?>
  86. <tr>
  87. <td align="right" class="style3"><?php echo $result['$i'];?></td>
  88. <td align="right" class="style3"><?php echo $result['batch'];?></td>
  89. <td align="right" class="style3"><?php echo $result['center']; ?>
  90. <td align="right" class="style3"><?php echo $result['code']; ?></td>
  91. <td align="right" class="style3"><?php echo $result['created_at']; ?></td>
  92.  
  93. </tr>
  94.  
  95. <?php } ?>
  96.  
  97. </table>
  98. <table width="200" border="0">
  99. <tbody>
  100. <tr>
  101. <td>&nbsp;</td>
  102. </tr>
  103. </tbody>
  104. </table>
  105.  
  106. </div>
  107. </body>
  108. </html>
  109. <?Php
  110. $html = ob_get_contents();
  111. ob_end_clean();
  112. $pdf = new mPDF('th', 'A4','0','');
  113. $pdf->SetAutoFont();
  114. $pdf->SetDisplayMode('fullpage');
  115. $pdf->WriteHTML($html, 2);
  116. $pdf->Output();
  117. ?>
Add Comment
Please, Sign In to add comment