How to save headers for all pages of exported pdf in php?

I export data from a php page to pdf when the data exceeds the page limit, the header is not available for sequential pages function where I call export to pdf 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( 'newpdf',$data, true); pdf_create($html, $cur_date); } } 

This is my browse page from which I export data to pdf name Country state City

 </tr> 

Here I get the result as

Page 1

Name country State Town
udaya india Tamilnadu kovai
chandru srilanka columbo aaaaa

Page: 2
vivek england gggkj gjgjkj

on page 2 i don't get the headers name, country, state and city

+4
source share
2 answers

This may help if you specify the PDF library you are using. I know that TCPDF supports table splitting between pages and repeats the table headers on each page, so you can check this.

See Example 48 on the next page for an example of table headers: http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf_examples

+4
source

I know this is an old, rather vague question, but if others have a problem like me:

Of course, this depends on the library, but using mPDF, the table headers will be repeated on several pages if you wrap your heading and body in 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> 
+1
source

Source: https://habr.com/ru/post/1305194/


All Articles