【问题标题】:php-pdftk: fillForm with spaced PDF form fieldsphp-pdftk:带有间隔 PDF 表单字段的 fillForm
【发布时间】:2022-12-15 18:34:54
【问题描述】:

我使用以下代码使用 php-pdftk 包填写 pdf 表单。

$pdf = new Pdf(public_path() . '/pdf/work_order.pdf');
        $result = $pdf->fillForm([
            'name_field' => 'sample name',
            'email_field' => 'sample@ac.com',
            'phone_field' => '0000000',
            'enquiry_field' => 'Sample details page',
        ])
            ->needAppearances()
            ->saveAs(public_path() . '/pdf/work_order_filled.pdf');

这个代码库没有任何问题。我必须用字段名称填写另一个 pdf,如下所示,

/Fields [
<<
/V ()
/T (Client first and last name 2)
>> 
<<
/V /Off
/T (Belting checkbox)
>> 
<<
/V ()
/T (Confirmation time in)
>> 
<<
/V ()
/T (Technician signature 2)
>> 
<<
/V ()
/T (Client agreement number)

所以,我修改了代码库如下,

$pdf = new Pdf(public_path() . '/pdf/work_order.pdf');
        $result = $pdf->fillForm([
            'Client first and last name 2' => 'sample name',
            'Belting checkbox' => 'sample@ac.com',
            'Confirmation time in' => '0000000',
            'Technician signature 2' => 'Sample details page',
        ])
            ->needAppearances()
            ->saveAs(public_path() . '/pdf/work_order_filled.pdf');

它会生成错误,而不会创建填充的 pdf 文件。上面给定的数组键(带有空格)中的问题。

所以,请帮我解决上述问题。

【问题讨论】:

    标签: php pdf php-pdftk


    【解决方案1】:

    您好,您找到解决方案了吗?谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-13
      • 2021-01-01
      • 2016-08-08
      • 1970-01-01
      • 2018-12-04
      • 1970-01-01
      • 1970-01-01
      • 2012-02-03
      相关资源
      最近更新 更多