【问题标题】:TCPDF with FPDI templates and THEAD带有 FPDI 模板和 THEAD 的 TCPDF
【发布时间】:2012-11-01 16:51:12
【问题描述】:

我有一个带有writeHTML 的 THEAD 输出的 html 表格,它应该显示在表格顶部的每个页面上。它可以工作,但是当我使用由 FPDI 加载的模板时,头部是白色的,并且在第二页上消失了。我可以用鼠标标记头部字段,但显示为白色。边框仅显示为左侧的一个小点。

我已经尝试将$this->setPageMark() 添加到addPage 方法中。但它仍然是同样的问题。

public function AddPage($orientation = '', $format = ''){
    parent::AddPage($orientation, $format);
    if($this->template != null){
        $this->useTemplate($this->template);
        $this->setPageMark();
    }
}

【问题讨论】:

    标签: pdf tcpdf fpdi


    【解决方案1】:

    您需要在开头启用分页符,这会导致您遇到的问题; 这是一个示例代码 sn -p ;

    require_once('tcpdf/tcpdf.php'); //main code    
    require_once('tcpdf/fpdi.php');  //read existing pdf and sends to fpdf
    $pdf = new FPDI();
    $pdf->setPrintHeader(false); //no header
    $pdf->setPrintFooter(false);//no footer    
    $pdf->SetAutoPageBreak(FALSE, 0); // set auto page breaks
    //loop starts here
    { 
        $pdf->setSourceFile($page_background); //set page                                                                                                                                                             
        $templateId = $pdf->importPage(1); //we only need the first page                                                                                   
        $pdf->useTemplate($templateId);     //use the imported page
        //your write html code and any other tcpdf related code comes here
    }
    $pdf->Output(outcome.pdf, 'I'); //use F instead of I  to show generated pdf. 
    

    【讨论】:

      猜你喜欢
      • 2013-11-23
      • 2019-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多