php tcpdf
TCPDF ul li works actually
December 25, 2022
0
$pdf = new PdfLibrary('P', 'mm', 'A4', true, 'UTF-8', false);
      //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
      $pdf->SetTitle('My Title');
      $pdf->SetHeaderMargin(30);
      $pdf->SetTopMargin(30);
      $pdf->setFooterMargin(30);
      $pdf->SetAutoPageBreak(true);
      $pdf->SetAuthor('Author');
      $pdf->SetDisplayMode('real', 'default');



      $pdf->AddPage();

      $pdf->SetLineStyle( array( 'width' => 5, 'color' => array(0,0,0)));

      $pdf->Line(0,0,$pdf->getPageWidth(),0);
      $pdf->Line($pdf->getPageWidth(),0,$pdf->getPageWidth(),$pdf->getPageHeight());
      $pdf->Line(0,$pdf->getPageHeight(),$pdf->getPageWidth(),$pdf->getPageHeight());
      $pdf->Line(0,0,0,$pdf->getPageHeight());

      //https://ourcodeworld.com/articles/read/275/how-to-encrypt-a-pdf-password-protection-against-copy-extraction-or-modifications-generated-with-tcpdf-in-php
      //$pdf->SetProtection(array('print', 'copy','modify'), "ourcodeworld", "ourcodeworld-master", 0, null);

      $pdf->SetMargins(10, 20, 10, true);
      //$pdf->Write(5, 'Some sample text');
      $html =  <<<SQL
               
                <div style="text-align: left;"> 
                   
                   <ul>
                     <li>1.   Commission percentage: The commission percentage will be <span style="background-color: #FFFF00">12%</span>.</li>
                      <li><span style="margin-top:10px;padding-top:10px;padding-bottom:20px;">2.  Execution and Performance: The agreement is only effective after approval and confirmation by BdBooking.com</span></li>
                      <li>3.    General delivery terms: This Agreement is subject to and governed by the General Delivery Terms. The Accommodation declares that it has read and hereby accepts the terms and conditions</li>
                      <li>4. Date: 19th December 2022 <br/><br/></li>
                   <br pagebreak="true" />
                      <li>5.  Obligations: The following definitions apply throughout this Agreement.
                        <ul style="list-style-type: circle;">
                              <li >Information given by property including Photos, rates including other taxes, quantity of rooms, Cancelation, no-show, Payment option and other policies should be comply with BdBooking.com agreement.</li>
                              <li>If property close should be notify BdBooking.com.</li>
                              <li>The Accommodation represents that the Accommodation Information shall at all times be true, accurate and not misleading. The Accommodation shall update the Accommodation Information on a daily basis at any time – change via the Extranet. </li>
                              <li>For each reservation made on the Platforms by a Guest for a Room, the Accommodation shall pay BdBooking.com a commission calculated in accordance with per reservation is equal to the multiple of (i) the number of nights stayed at the Accommodation by the Guest; (ii) the booked rate per room per night (excluding sales taxes and such other applicable taxes and payment shall made accordance with clause 16.</li>
                              
                        </ul>
                      </li>
                   </ul>
               </div>    
SQL;


      //$pdf->setCellMargins(0, 5, 0, 5);
      //$pdf->setCellPaddings(0, 5, 0, 5);

      $pdf->setHtmlVSpace(array(
         'li' => array(
            'h' => 0.5, // margin in mm
         )
      ));

      $pdf->writeHTML($html, true, false, true, false, '');
//https://stackoverflow.com/questions/64155011/generating-pdf-in-codeigniter-4-outputs-weird-characters
$this->response->setHeader("Content-Type", "application/pdf");
$pdf->Output('My-File-Name.pdf', 'I');

 

reference:
https://stackoverflow.com/questions/27543304/tcpdf-list-item-margin

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

hitpath API: Read Affiliates Record

<?php $offset = 0; $limit = 10; $url = "http://...

Read more

hitpath API: Read Campaigns Record

<?php $offset = 0; $limit = 10; $url = "http://...

Read more

hitpath API: Read Advertisers Record

<?php $offset = 0; $limit = 10; $url = "http://...

Read more

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *