0) { $sqlview2 = "SELECT * FROM ".tabel_halaman." where halaman_id=".$_GET['halaman']." AND status_halaman='1'"; $resultTU = mysql_query($sqlview2); while($rsTU2=mysql_fetch_array($resultTU)){ $namaTU=$rsTU2[nama_halaman]; $kategori=$rsTU2[kategori_halaman]; $includeNya=$rsTU2[file_include]; $pIsi=$rsTU2[isi_halaman]; $titleTambahan=$rsTU2[nama_halaman]; $titleTambahan = str_replace(" ","_",$titleTambahan); } } $pIsi="".$pIsi.""; $handle = fopen("halaman.html","w"); if (fwrite($handle, $pIsi) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($handle); require('html2fpdf.php'); $pdf=new HTML2FPDF(); $pdf->AddPage(); $fp = fopen("halaman.html","r"); $strContent = fread($fp, filesize("halaman.html")); fclose($fp); $pdf->WriteHTML($strContent); $pdf->Output("temp/".$titleTambahan.".pdf"); header("location: /pdf/temp/".$titleTambahan.".pdf"); //echo "PDF file is generated successfully!"; ?>