Ron
Ron

Reputation: 394

HTML to PDF footer overlapping

class.php` class file to convert a document from HTML to PDF . My form is dynamic so the total content may not fit in one page of the pdf . Now my client need that I have to put the company name on every pdf page footer so I have put this HTML

 <page_footer class="sou">
<br><br>
    <div style="text-align:center;">_______________________________________________</div>
    <br>
    <div style="text-align:center;">Este contrato foi elaborado em <a href="javascript:void(0)">www.contratorapido.com.br</a></div>
    <div style="text-align: right"><?php echo $order->order_id;?> p&aacute;gina [[page_cu]] de [[page_nb]]</div>

  </page_footer>

but this footer is overlapping the content of the pdf .The code I have used to create pdf is

   include('../../includes/config.php');
   if($_SESSION['cont_id']!=11)
   {
    header('location:'.SITEURL.'/my_account.php');
   }

    ob_start();
    include(dirname(__FILE__).'/res/config.php');
    include(dirname(__FILE__).'/res/pdf_urban.php');
    $content = ob_get_clean();

    require_once(dirname(__FILE__).'/../html2pdf.class.php');

    try
    {
        $html2pdf = new HTML2PDF('P','A4','fr', false, 'ISO-8859-15', array(16, 25, 16, 21));
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));

        $html2pdf->Output('Contract.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

Please help me to sort out the problem that how could I put the footer on every page without overlapping the main content .

Upvotes: 1

Views: 3046

Answers (1)

Praveen D
Praveen D

Reputation: 2377

Try below for html2pdf library

<page backtop="14mm" backbottom="14mm" backleft="10mm" backright="10mm" style="font-size: 12pt">
     <page_header>
        <div>
            YOUR CONTENT FOR HEADER
        </div>
    </page_header>

    <page_footer>
        <div>
           YOUR CONTENT FOR FOOTER
            </div>
        </div>
    </page_footer>
    <bookmark title="Presentation" level="0" ></bookmark>

    <div style="margin:0 auto; font-size: 12px; color:#333">
        <div>
        CONTETN OF MIDDEL PAGES
        </div>
    </div>
</page>

Upvotes: 2

Related Questions