duanbi9202 2018-09-06 02:11
浏览 53
已采纳

从php生成PDF

I have a problem using FPDF for generate PDF File, this is my code

foreach($result as $row)
{
    $pdf->Ln(); 
    $pdf->Image("../img/ss/".$row['nama_foto'],10,30,-150);
    $pdf->Cell(5,150,$row['subject_ticket'],0,0,'L');

    $pdf->SetFont('Times','',9);
    $pdf->Cell(1,165,"Category : ".$row['kategori'],0,0,'L');
    $pdf->Cell(1,175,"File Uploaded : ".$row['nama_file'],0,0,'L');
    $pdf->Cell(1,185,"Messages : ".$row['isi_ticket'],0,0,'L');

}

and this is a screenshot enter image description here

I want to set Left Alignment for all cell, but the result stuck like that.

  • 写回答

1条回答 默认 最新

  • ds0678 2018-09-06 02:18
    关注

    You should use the setX method as follows to set the X position of the Cell

        $pdf->SetFont('Times','',9);
        $pdf->setX(0);
        $pdf->Cell(1,165,"Category : kategor",0,0,'L');
        $pdf->setX(0);
        $pdf->Cell(1,175,"File Uploaded : nama_file",0,0,'L');
        $pdf->setX(0);
        $pdf->Cell(1,185,"Messages : isi_ticket",0,0,'L');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥15 小红薯封设备能解决的来
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'
  • ¥15 vue+element项目中多tag时,切换Tab时iframe套第三方html页面需要实现不刷新
  • ¥50 深度强化学习解决能源调度问题
  • ¥15 一道计算机组成原理问题