PDF表单填写多个数据

时间:2018-02-06 11:56:31

标签: php codeigniter pdf

我从$ data变量中得到了数据库中的所有值,并且我尝试用可填充打印填充所有数据。但问题是如果有5种不同的数据,那么PDF应该有多个带有可填写PDF打印的页面。我需要在单个pdf文档中使用多个数据。

现在代码以PDF格式填写最后一个值。我需要使用可编辑的表单创建一个PDF格式的新页面。

$data = [
            'app_no'    => $bid_num,
            'unique_no'    => $unique,
            'unique_no2'    => $unique,
            'cut_off'    => 'CUT OFF',
            'cut_off2'    => 'CUT OFF',
            'name1' => $client_name,
            'name2'    => $client_name2,
            'address1'   => $client_address,
            'branch_code'   => $branch_code,
            'area'   => $client_area,
            'city'   => $client_city,
            'pin'   => $k->client_pin,
            'email'   => $client_email,
            'phone'   => $client_contact,
            'pan'   => $k->client_pan,
            'pan2'   => $k->client_pan,
            'pan3'   => $k->client_pan,
            'client_id1' => $client_id,
            'client_id3' => $client_id,
            'NSDL'    => $nsdl,
            'CDSL'   => $cdsl,
            'personal'   => $person,
            'huf'    => $huf,
            'other'    => $other,
            'date'   => $date,
            'bank_name2'    => $bank_name.', '.$bank_city,
            'bank_acco_no1' => $client_account_no,
            'amount_block2'    => $total,
            'client_id2'   => $client_id,
            'app_no2'   => $bid_num,
            'bank_no3'    => $client_account_no,
            'bank_name' => $bank_name.', '.$bank_city,
            'amount_words'    => $total_words,
            'amount_blocked'   => $total,
            'share'   => $share,
            'Retail'   => '<</T(Retail)/V(Yes)>>',
            'amount_block3'    => $total,
            'share2' => $share,
            'email2'    => $client_email,
            'phone2'   => $client_contact,
            'client_name'   => $k->client_name,
            'app_no3'    => $bid_num,
            'bank_name3' => $bank_name.', '.$bank_city,
            'bank_name4' => $bank_name.', '.$k->bank_city,
            'bank_acco_no2'   => $client_account_no,
            'name3'   => $k->client_name
        ];

        $pdf = new PdfForm($pdf, $data); // $pdf is pdf name which is fillable PDF

        $pdf->flatten()
            ->save('output.pdf')
            ->download();
        }

看一次,请帮我弄清楚。

1 个答案:

答案 0 :(得分:0)

尝试var_dump你的$ data变量。它从你的代码看起来像一个有多个值的数组而不是多个值有多个值的数组。你有这样的东西:$ data = array [0 =&gt;数组[...这里你的价值],1 =&gt;数组[...这里所有的值]]等等。