开发者

How to retain headers for all the pages of an exported pdf in php?

I am exporting data from php page to pdf when the datas exceeed the page limit the header is not available for the consecutive pages function where i call the export to pdf is function changeDetails() { $bType = $this->input->post('textvalue');

                  if($bType == "pdf")
        {
            $this->load->library('table');
            $this->load->plugin('to_pdf');
            $data['countrytoword'] = $this->AddEditmodel1->export();
            $this->table->set_heading('Country','State','Town','Name');
            $out =  $this->table->generate($data['countrytoword']);
            $html = $this->load->view( 'n开发者_JS百科ewpdf',$data, true);
            pdf_create($html, $cur_date);
        }
    }

This is my view page from which i export data to pdf Name Country State Town

</tr>

Here I am getting the result as

page:1

Name country State Town

udaya india Tamilnadu kovai

chandru srilanka columbo aaaaa

page:2

vivek england gggkj gjgjkj

in the page 2 i dont get the headers name, country ,state and town


It might help if you specifiy the PDF library you are using. I know that TCPDF supports spanning of tables across pages and it will repeat the table headers on every page, so you might check it out.

Check example 48 on the following page to see an example of table headers : http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf_examples


I know this is an old, rather vague question, but in case others have this problem as I did:

It of course depends on the library, but using mPDF, table headers will repeats on multiple pages if you wrap your header and body in and tags:

  <table>
   <thead>
    <tr>
     <th>Head 1</th>
     <th>Head 2</th>
     <th>Head 3</th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>1</td>
     <td>2</td>
     <td>3</td>
    </tr>    
    etc...  
   </tbody>
  </table>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜