修复tcpdf中的页脚图像 $path=Yii::app()->basePath; 只需要一次($path.'/extensions/tcpdf/tcpdf.php'); $pdf=新的TCPDF(); $pdf->setPrintHeader(假); $pdf->setPrintFooter(true); $pdf->SetAutoPageBreak(真,0); $pdf->AddPage(); $pdf->SetLineWidth(0.1); $pdf->SetFont('times','',10); $pdf->SetMargins(20,20,20,true); $footer\u image\u file=Yii::app()->request->baseUrl'/images/logo.jpg'; $content='$content'; $pdf->writeHTML($content,true,false,true,false,”); ob_end_clean(); $pdf->输出(“Reports.pdf”、“D”);

修复tcpdf中的页脚图像 $path=Yii::app()->basePath; 只需要一次($path.'/extensions/tcpdf/tcpdf.php'); $pdf=新的TCPDF(); $pdf->setPrintHeader(假); $pdf->setPrintFooter(true); $pdf->SetAutoPageBreak(真,0); $pdf->AddPage(); $pdf->SetLineWidth(0.1); $pdf->SetFont('times','',10); $pdf->SetMargins(20,20,20,true); $footer\u image\u file=Yii::app()->request->baseUrl'/images/logo.jpg'; $content='$content'; $pdf->writeHTML($content,true,false,true,false,”); ob_end_clean(); $pdf->输出(“Reports.pdf”、“D”);,yii,tcpdf,Yii,Tcpdf,我想在fooder中为每个新页面添加图像。。请任何人帮助我…只需将显示图像的代码放在Footer()基方法中即可。AddPage()方法和Close()为任何新页面调用此基本方法。 重要提示:不应直接调用Footer方法 该方法应该在类中实现,因此如下所示重写它: $path = Yii::app()->basePath; require_once($path . '/extensions/tcpdf/tcpdf.php'); $pdf =

我想在fooder中为每个新页面添加图像。。请任何人帮助我…

只需将显示图像的代码放在Footer()基方法中即可。AddPage()方法和Close()为任何新页面调用此基本方法。 重要提示:不应直接调用Footer方法

该方法应该在类中实现,因此如下所示重写它:

 $path = Yii::app()->basePath;
            require_once($path . '/extensions/tcpdf/tcpdf.php');
            $pdf = new TCPDF();
            $pdf->setPrintHeader(false);
            $pdf->setPrintFooter(true);
            $pdf->SetAutoPageBreak(TRUE, 0);
            $pdf->AddPage();
            $pdf->SetLineWidth(0.1);
            $pdf->SetFont('times', '', 10);
            $pdf->SetMargins(20, 20, 20, true);
           $footer_image_file = Yii::app()->request->baseUrl.'/images/logo.jpg';
           $content = '<div> $content </div>'; 
            $pdf->writeHTML($content, true, false, true, false, '');
            ob_end_clean();
            $pdf->Output("Reports.pdf", "D");
我希望这有帮助,我也很理解你的问题

function Footer()
{ 
   .... /* Put your code here (see a working example below) */

   $logoX = 186; // 186mm. The logo will be displayed on the right side close to the border of the page
   $logoFileName = "/images/myLogo.jpg";
   $logoWidth = 15; // 15mm
   $logo = $this->PageNo() . ' | '. $this->Image($logoFileName, $logoX, $this->GetY()+2, $logoWidth);

   $this->SetX($this->w - $this->documentRightMargin - $logoWidth); // documentRightMargin = 18
   $this->Cell(10,10, $logo, 0, 0, 'R');
}

此代码完美地放置在页脚中央的图像中。非常感谢pti_jul.:-щщщ)

非常感谢:-щщщщ)在靠近页面边框的右侧显示的徽标。。我更改了$logoX=40$标识宽度=130$pdf->页脚(正确);现在它显示得非常完美……非常感谢:-()()()()()()())())()()()()())))()))(?我在你的评论中看到你的代码提到:
$pdf->Footer(true);
。请注意,正如我在上面的帖子中所说,作者不建议直接调用它。请参阅
function Footer()
{ 
   .... /* Put your code here (see a working example below) */

   $logoX = 40; // 
   $logoFileName = "/images/myLogo.jpg";
   $logoWidth = 130; // 15mm
   $logoY = 280;
   $logo = $this->PageNo() . ' | '. $this->Image($logoFileName, $logoX, $logoY, $logoWidth);

   $this->SetX($this->w - $this->documentRightMargin - $logoWidth); // documentRightMargin = 18
   $this->Cell(10,10, $logo, 0, 0, 'C');
}