อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
Ittichai_chupol
PHP VIP Members
PHP VIP Members
โพสต์: 5410
ลงทะเบียนเมื่อ: 19/09/2018 10:33 am

อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf

โพสต์ที่ยังไม่ได้อ่าน โดย Ittichai_chupol »

ผมอยากทราบว่า ถ้าหากต้องการที่จะแปลง ไฟล์ html มาเป็นไฟล์ pdf โดยการส่งค่าไฟล์ html ผ่านไปยังเซิฟเวอร์เพื่อใช้สำหรับแปลง html ให้กลายมาเป็น pdf ก่อนออกมาเป็นไฟล์ ดาวน์โหลด pdf โดยปัญหามีอยู่คือว่า เมื่อผม ส่งไฟล์ html ไป ยัง เซิฟเวอร์ แล้วทำการแปลง เพื่อดาวน์โหลดออกมาเป็นไฟล์ pdf นั้น เมื่อเปิดไฟล์ pdf ที่ดาวน์โหลดมานั้น ไม่สามารถเปิดไฟล์ที่ดาวน์โหลดไม่ได้ ผลลัพธ์ที่ผมได้รับดังนี้ครับ
2020-05-18 (1).png
2020-05-18 (1).png (20.74 KiB) Viewed 1353 times
ส่วนการตั้งค่า เซิฟเวอร์ ครับ
screenshot-127.0.0.1-2020.05.18-12_18_43.png
screenshot-127.0.0.1-2020.05.18-12_18_43.png (15.36 KiB) Viewed 1353 times
โคด html ที่ผมต้องการแปลงครับ

โค้ด: เลือกทั้งหมด

<style>
    body{
        font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
        font-size: 14px;
        line-height: 1.42857143;
        color: #333;
    }
    .image_logo{
        height: 150px;
    }

    .phone_inline{
        display: inline;
    }

    .border_recelpt{
        border: 2px solid black;
        /* border-radius: 10px 0px; */
        text-align: center;
/*        margin: 12px 20%;*/
        padding: 10px 0;
    }
    .paper_a4{
        width: 793.7px;
        height: 1122.5px;
    }
    .paper_a4 .head_paper_a4{
        padding-top: 40px;
    }
    .invoice_body{
        background-color: #fff;
        margin: 0 auto;
    }
    .num_invoice{
        display: inline;
    }
    .table_invoice .head_table_invoice
    {
        padding-top: 30px;
    }
    .head_table{
        background-color: #d9d9d9;
        height: 40px;
    }
    .table_invoice .text_price_totle{
        height: 30px;
        background-color: #d9d9d9;
    }
    .text_price_totle{
        background-color: #d9d9d9;
    }
    .footer_invoice .payment_method_invoice{
        border: 1px solid #000;
        height: 100px;
        margin-top: 20px;
    }
    .footer_invoice .payment_method{
        margin: 15px 0 10px 15px;
    }
    .footer_invoice .bank_name_invoice,.footer_invoice .date_invoice{
        margin: 0 0 5px 15px;
    }
    .footer_invoice .signature_company_box{
        border: 0px solid #000;
        height: 100px;
        margin-top: 20px;
        padding-top: 15px;
        text-align: center;
    }
    .footer_invoice .signature_company{
        padding-bottom: 18px;
    }
    .show_in_line{
        display: inline;
    }
    .text_invoice_left{
        float:left;
    }
    .text_invoice_right{
        float:right;
        padding-top: 5px;
    }
    .image_icon{
        width: 15px;
        height: 15px;
    }

    .recelpt_text{
        margin: 0px;
        font-size: small;
    }

    .text-center {
        text-align: center;
    }

    .recelpt_point{
        margin-bottom: 0px;
        margin-top: 50px;
    }

    .recelpt_point{
        text-align: center;
    }

    .term_of_payment{
        margin: 0 0 20px 0px;
    }
    .befot_point{
        margin-top: 10px;
    }

    .table_point{
        border-collapse: collapse;
        margin: auto;
    }
    .pull-right {
        float: left;
    }
    .bg-gray {
        background-color: #d9d9d9;
    }
    .border-top-double {
        border-top: 3px double #000;
    }
    .border-black {
        border: 1px solid #000;
        border-radius: 10px;
        margin: 5px 5px 5px 0;
        padding: 5px;
    }
    .free_table{
        height: 15px;
    }
    h3 {
        display: block;
        font-size: 1em;
        margin-block-start: 1em;
        margin-block-end: 1em;
        margin-inline-start: 0px;
        margin-inline-end: 0px;
        font-weight: bolder;
        margin-bottom: 0px;
    }
    p.small {
        display: block;
        margin-block-start: 1em;
        margin-block-end: 1em;
        margin-inline-start: 0px;
        margin-inline-end: 0px;
        margin-top: 0px;
        margin-bottom: 0px;
        font-size: 11px;

    }
</style>
<div class="paper_a4">
    <div class="head_paper_a4"></div>
    <div class="invoice_body">
        <div class="head_invoice">
            <table border="0" width="100%">
                <tr>
                    <td width="20%" height="130px;" >
                        <img src="http://122.155.168.168/~mdsoft/thaivi32/styles/thaivi/theme/images/index_logo.png" alt="" style="height: 80px;" class="image_logo">
                    </td>
                    <td width="50%">
                        <h3>สมาคนนักลงทุนเน้นคุณค่า(ประเทศไทย)</h3>
                        <p class="small">388 อาคารเอส พี ถนนพหลโยธิน
                            แขวงสามเสนใน เขตพญาไท กรุงเทพ 10400</p>
                        <p class="small">โทรศัพท์ : 02-619-1355  โทรสาร 02-619-1455</p>
                        <p class="small">เลขประจําตัวผู้เสียภาษีอากร 0 9930 00281 81 1</p>
                    </td>
                    <td width="30%">
                        <div class="border_recelpt">
                            <p class="recelpt_text">ใบกำกับภาษีอย่างย่อ/ใบเสร็จรับเงิน</p>
                            <p class="recelpt_text">INVOICE</p>
                        </div>
                    </td>
                </tr>
            </table>
            <table border="0" width="100%">
                <tr>
                    <td width="60%">
                        <p>ชื่อลูกค้า ทันจิโร  คามาโดะ</p>
                    </td>
                    <td width="60%">
                        <p>วันที่    18/05/2020</p>
                    </td>
                </tr>
            </table>

            <table width="99%" border="1" class="table_point">
                <tr class="head_table">
                    <td width="5%"> <div align="center">ลำดับ</div></td>
                    <td width="54%"> <div align="center">รายการ</div></td>
                    <td width="8%"> <div align="center">จำนวน</div></td>
                    <td width="12%"> <div align="center">ราคา/หน่วย</div></td>
                    <td width="21%"> <div align="center">จำนวนเงิน</div></td>
                </tr>

                <tr>
                    <td> <div align="center"></div></td>
                    <td> <div align="center">ค่าสมาชิกสมาคมราย ฟรี</div></td>
                    <td> <div align="center">1</div></td>
                    <td> <div align="center">0</div></td>
                    <td> <div align="right">0</div></td>
                </tr>

                <tr>
                    <td colspan="3" rowspan="3">
                        <p class="term_of_payment">
                            หมายเหตุ : หากต้องการฉบับจริงติดต่อสมาคม 02-619-1455
                        </p>
                    </td>
                    <td colspan="2"> <div class="text_invoice_left">รวมเงิน</div><div class="text_invoice_right">0</div></td>
                </tr>
                <tr>
                    <td colspan="2"> <div class="text_invoice_left">ภาษีมูลค่าเพิ่ม 7%</div><div class="text_invoice_right">0.00</div></td>
                </tr>
                <tr>
               </tr>
                <tr>
                    <td colspan="3" class="text_price_totle"><div>ตัวอักษร  บาทสตางค์</div></td>
                    <td colspan="2"> <div class="text_invoice_left">จำนวนเงินทั้งสิ้น</div><div class="text_invoice_right">0.00</div></td>
                </tr>
            </table>
            <div class="befot_point">

            </div>
            <table border="0" width="99%" class="table_point">
                <tr>
                    <td align="center"  width="33.333%">

                        <p class="recelpt_point">..............................................</p>
                        <p   class="recelpt_text_point"> (ผู้รับเงิน)   </p>
                    </td>
                    <td width="33.333%">
                       
                    </td>
                    <td width="33.333%">
                        
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>

จึงอยากทราบว่าควรปรับแก้ไขอยากไรครับ
ขอให้วันนี้เป็นวันที่ดี
ภาพประจำตัวสมาชิก
Ittichai_chupol
PHP VIP Members
PHP VIP Members
โพสต์: 5410
ลงทะเบียนเมื่อ: 19/09/2018 10:33 am

Re: อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf

โพสต์ที่ยังไม่ได้อ่าน โดย Ittichai_chupol »

ขนาดไฟล์ html ก่อนการแปลง 8k
กับขนาดไฟล์ pdf นั้นมีขนาดเท่ากัน 1k

เมื่อลองเข้าไปยัง เซิฟตรงๆพบปัญหาดังนี้
2020-05-19.png
2020-05-19.png (23.87 KiB) Viewed 1335 times
ขอให้วันนี้เป็นวันที่ดี
ภาพประจำตัวสมาชิก
Ittichai_chupol
PHP VIP Members
PHP VIP Members
โพสต์: 5410
ลงทะเบียนเมื่อ: 19/09/2018 10:33 am

Re: อยากทราบวิธีการ แปลง ไฟล์ html มาเป็น pdf

โพสต์ที่ยังไม่ได้อ่าน โดย Ittichai_chupol »

อยากทราบว่า จะต้องใช้ web service api สำหรับที่จะมาแปลง จาก html มาเป็น pdf ครับ
ขอให้วันนี้เป็นวันที่ดี
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 110