简体   繁体   中英

custom table of content in mdpf

I use mdpf plugin. And I create table of content follow this.

I create html view in pdf_frm01.php file

<html>
<body>

     <!-- focus this and I want in same page -->
     <div class="toc">
        <div>Table of content</div>
        <tocpagebreak />
     </div>
     <!-- -------- --->

     <div style="page-break-before : always">  
       <tocentry content="1. bbbbbbbbb" />
       <div>page 2</div>
     </div>

     <div style="page-break-before : always">
       <tocentry content="2. cccccccccc" />
       <div>page 2</div>
     </div>

</body>
</html

And I create pdf.php for control mpdf action

$pdf_custom = getcwd().'/lib/mpdf/mpdf.php';        
require_once($pdf_custom);      

$pdf = new mPDF();
$html = $this->load->view('pdf_frm01.php',$data,true);  //load text from file
$pdf->writeHTML($html);
$pdf->Output("frm_01",'I'); 

But. I have a problem.

I want to create a custom table of content style.

I want Table of content (text) on top the table of content.

In table of content. I want to change font-family, font-size, line-height etc.

How to create a custom content table style? or can you recommend me?

Read documentation: https://mpdf.github.io/what-else-can-i-do/table-of-contents.html you can add custom CSS:

$mpdf->WriteHTML('style.css'), 1);

to change default style TOC. But the problem is that some of custom style not working - I cannot remove "bold" from TOC font.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM