php ใช้ tcpdf เพื่อพิมพ์งานลองโปรแกรมตัวอย่างแล้วไม่สำเร็จ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา php ใช้ tcpdf เพื่อพิมพ์งานลองโปรแกรมตัวอย่างแล้วไม่สำเร็จ

php ใช้ tcpdf เพื่อพิมพ์งานลองโปรแกรมตัวอย่างแล้วไม่สำเร็จ
ได้ลองใช้ tcpdf ดูโดยศึกษาจากโปรแกรมตัวอย่าง เกิด warning และ error ไม่เข้าใจครับ และไม่รู้จะแก้ไขอย่างไร ขอคำแนะนำด้วยครับ
จากตัวโปรแกรมด้านล่างครับ..
===========
<?php
require_once("html2pdf/setPDF.php");
// เพิ่มหน้าใน PDF 
$pdf->AddPage();
 
// กำหนด HTML code หรือรับค่าจากตัวแปรที่ส่งมา
// กรณีกำหนดโดยตรง
// ตัวอย่าง กรณีรับจากตัวแปร
// $htmlcontent =$_POST['HTMLcode'];
$htmlcontent='<p>ทดสอบ</p>';
$htmlcontent=stripslashes($htmlcontent);
$htmlcontent=AdjustHTML($htmlcontent);
 
// สร้างเนื้อหาจาก  HTML code
$pdf->writeHTML($htmlcontent, true, 0, true, 0);
 
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->lastPage();
 
// ปิดและสร้างเอกสาร PDF
$pdf->Output('test.pdf', 'I');
?>
==========
เมื่อ run program แล้วผลดังนี้ครับ..

.....

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Library/WebServer/Documents/somesite/html2pdf/tcpdf.php on line 7332

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Library/WebServer/Documents/somesite/html2pdf/tcpdf.php on line 7332

Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/Documents/somesite/html2pdf/tcpdf.php:7332) in /Library/WebServer/Documents/somesite/html2pdf/tcpdf.php on line 5377
TCPDF ERROR: Some data has already been output to browser, can't send PDF file
-------------------------


Panuchat 125.24.164.xxx 13-05-2015 01:51:37

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
ข้อมูลจากบทความนี้ บางทีไม่ค่อยสมบูรณ์เท่าไหร่ เพราะไม่สามารถแปลง html เป็น pdf ได้อย่างสมบูรณ์

ประยุกต์สร้าง pdf ไฟล์ จาก tcpdf class ด้วย php รองรับภาษาไทย 
https://www.ninenik.com/content.php?arti_id=226 via @ninenik

ลองใชิแบบนี้แทน เผื่อช่วยได้

ตัวอย่าง tcpdf ดึงข้อมูลจากฐานข้อมูล สร้าง report อย่างง่าย 


ninenik 183.89.90.xxx 13-05-2015
 ความคิดเห็นที่ 2
ต้องกราบขอบพระคุณคุณ ninenik ครับ แต่ก็ยังงงง และยังคง error อยู่นะครับ 


panuchat 49.228.192.xxx 13-05-2015 12:09
 ความคิดเห็นที่ 3
ตามระบบแจ้ง เหมือนต้องมีการกำหนด date.timezone ในไฟล์ php.ini  ลองเช็คค่านี้ดู ไม่เคยเจอปัญหาคล้ายนี้มาก่อน
อาจเป็นจากเราไม่ได้กำหนด date.timezone  หรือเปล่า ลองกำหนด แล้วรีสตาร์ท server  ไม่รู้เกี่ยวไหม ลองไล่ดู 



ninenik 183.89.90.xxx 13-05-2015
 ความคิดเห็นที่ 4
 กราบขอบพระคุณมากครับ เวปนี้สุดยอด ขอฝากเนื้อฝากตัวด้วยครับ 


panuchat 49.228.192.xxx 13-05-2015 16:29
1






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ