小编BAG*_*man的帖子

为什么我的FPDF类函数SetMargins()不影响第一行?

我正在使用FPDF类根据mysql查询的结果创建一个pdf.信息按照预期在表格中输出为pdf,但是当我使用SetMargins()设置页边距时出现问题.除第一行外的所有内容都有效.第一行似乎是硬编码到某个位置或边距定义.

这是我的代码:

class Table extends FPDF
{
    public function CreateTable($header, $data)
    {
        //Header
        $this->SetFillColor(255);
        $this->SetTextColor(0);
        $this->SetFont('Arial','B', 12);
        foreach ($header as $col) {
            $this->Cell($col[1], 10, $col[0], 1, 0, 'C');
            //Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, boolean fill [, mixed link]]]]]]])
        }

        $this->Ln();

        //Data
        $this->SetFillColor(255);
        $this->SetTextColor(0);
        $this->SetFont('Arial', '', 8);
        foreach ($data as $row) {

            $i = 0;
            foreach ($row as $field) {
                $this->Cell($header[$i][1], 6, $field, 1, 0, 'C');
                $i++;

            } …
Run Code Online (Sandbox Code Playgroud)

php mysql fpdf

2
推荐指数
1
解决办法
3278
查看次数

标签 统计

fpdf ×1

mysql ×1

php ×1