Advertisement
newm4n

Untitled

Jan 18th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. session_start();
  4. include_once("config.php"); //buat koneksi ke database
  5. $kode = $_GET['kode']; //kode berita yang akan dikonvert
  6. $query = mysql_query("SELECT * FROM SISWA WHERE NIS='".$kode."'");
  7. $data = mysql_fetch_array($query);
  8. ob_get_clean();
  9.  
  10. $content = "<html xmlns=\http://www.w3.org/1999/xhtml\"> <!-- Bagian halaman HTML yang akan konvert --> ".
  11.     "<head>".
  12.     "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />".
  13.     // ...
  14.     "( Anggun Patriana )</p>".
  15.     "</body>".
  16.     "</html>";
  17.  
  18. $filename="mhs-".$kode.".pdf";
  19. $content = ob_get_clean();
  20. $content = '<page style="font-family: freeserif">'.nl2br($content).'</page>';
  21. require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
  22. try
  23. {
  24. $html2pdf = new HTML2PDF('P','A4','en', false, 'ISO-8859-15',array(30, 0, 20, 0));
  25. $html2pdf->setDefaultFont('Arial');
  26. $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
  27. $html2pdf->Output($filename);
  28. }
  29. catch(HTML2PDF_exception $e) { echo $e; }
  30. ob_get_clean();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement