made some key changes in creat_pdf.php, plus a few others