Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. <?php
  2.  
  3. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  4.  
  5. // set header and footer fonts
  6. //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  7. //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  8.  
  9. // set default monospaced font
  10. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  11.  
  12. // set margins
  13. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  14. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  15. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  16.  
  17. // set auto page breaks
  18. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  19.  
  20. // set image scale factor
  21. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  22.  
  23. // set some language-dependent strings (optional)
  24. if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
  25. require_once(dirname(__FILE__).'/lang/eng.php');
  26. $pdf->setLanguageArray($l);
  27. }
  28. //$pdf->PDF_PAGE_ORIENTATION('L');
  29. $pdf->AddPage('L', array(210, 330));
  30. $pdf->SetTitle('ID Siswa');
  31. $pdf->SetHeaderMargin(false);
  32. $pdf->SetTopMargin(20);
  33. $pdf->setFooterMargin(20);
  34. $pdf->setJPEGQuality(75);
  35. $pdf->SetAutoPageBreak(true);
  36. $pdf->SetAuthor('Author');
  37. $pdf->SetDisplayMode('real', 'default');
  38.  
  39. //$i=0;
  40.  
  41. $html='<h3>ID SISWA</h3>
  42. <table cellspacing="1" bgcolor="#666666" cellpadding="2">
  43. <tr width="20%" bgcolor="#ffffff" >
  44. <th width="18%" align="center">id</th>
  45. <th width="18%" align="center">nisn</th>
  46. <th width="9%" align="center">NAMA</th>
  47. <th width="7%" align="center">JENIS KELAMIN</th>
  48. <th width="7%" align="center">KELAS</th>
  49. <th width="9%" align="center">TEMPAT LAHIR</th>
  50. <th width="8%" align="center">TANGGAL LAHIR</th>
  51. <th width="8%" align="center">QR CODE</th>
  52. </tr>';
  53. //<img src="tcpdf/examples/images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" />
  54. echo print_r($siswa);
  55. var_dump($siswa);
  56. foreach ($siswa as $sw => $a)
  57. {
  58. //$i++;
  59. $html.="<tr bgcolor='#ffffff'>
  60. <td>".$a['id_siswa']."</td>
  61. <td>".$a['nisn']."</td>
  62. <td>".$a['nama']."</td>
  63. <td>".$a['jk']."</td>
  64. <td>".$a['kelas']."</td>
  65. <td>".$a['tempat_lahir']."</td>
  66. <td>".$a['tanggal_lahir']."</td>
  67. <td><img src='assets/images/".$a['qr_code']."/></td>
  68. </tr>";
  69. }
  70. $html.='</table>';
  71. //$pdf->lastPage();
  72. $pdf->writeHTML($html, true, false, true, false, '');
  73. $pdf->Output('daftar_siswa.pdf', 'I');
  74.  
  75. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement