【问题标题】:How to retain headers for all the pages of an exported pdf in php?如何在php中保留导出pdf的所有页面的标题?
【发布时间】:2010-03-26 06:34:18
【问题描述】:

我正在将数据从 php 页面导出到 pdf 当数据超过页面限制时,标题对于连续页面不可用 我调用导出到pdf的函数是 函数更改详细信息() { $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);
        }
    }

这是我将数据导出为 pdf 的视图页面 姓名 国家 状态 镇

</tr>

在这里我得到的结果是

第 1 页

NamecountryStateTown
乌达亚印度泰米尔纳德邦科瓦伊
钱德鲁 斯里兰卡 哥伦布 aaaaa

第2页
vivek england gggkj gjgjkj

在第 2 页中,我没有得到标题名称、国家、州和城镇

【问题讨论】:

    标签: php pdf pdf-generation header


    【解决方案1】:

    如果您指定正在使用的 PDF 库,这可能会有所帮助。我知道TCPDF 支持跨页跨表,它会在每一页上重复表头,所以你可以看看。

    查看下一页上的示例 48 以查看表头示例: http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf_examples

    【讨论】:

      【解决方案2】:

      我知道这是一个古老的、相当模糊的问题,但如果其他人像我一样遇到这个问题:

      这当然取决于库,但是使用 mPDF,如果您将标题和正文包含在标签中,表格标题将在多个页面上重复:

        <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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-21
        • 2011-11-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多