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 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿