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

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