TCPDF - Header image only displays on first page

前端 未结 3 901
谎友^
谎友^ 2021-01-19 03:16

I am using TCPDF to generate a 2 page pdf document.

I have added a header and a footer to the document. The text part of the header and footer shows up correctly on

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-19 04:18

    I think is not related to header/footer, but I think TCPDF has bug that broken Image function with same image file loaded multiple times as reported here TCPDF - image displayed only once

    bug also present on actual version tecnickcom/tcpdf:6.2.26

    I resolve this problem by loading image outside and pass to the function as string.

    public function Header()
    {
        $this->Image('@'.file_get_contents('/home/xxxxxx/public_html/xxxxxxxx/uploads/logo/logo.png'),10,6,0,13);
    
        $this->SetFont('helvetica','B',20);
        $this->Cell(80);
        $this->Cell(0,0, $project->name . ' - Project Plan',$frame,0,'R');
        $this->Ln(8);
        $this->SetFont('helvetica','',10);
        $this->Cell(0,0, $organisation->name,$frame,0,'R');
        $this->Ln(10);
    }
    

提交回复
热议问题