PDFtk 不写入某些多行字段
PDFtk not writing to some multiline fields
我正在使用 PDFtk 从表单条目中填写交互式 PDF,但在使用 fill_form
命令合并 FDF 文件后,PDF 中的某些字段仍然空白。它似乎影响了一些多行字段 (FieldFlags: 4096
),但不是所有多行字段。
这是来自 pdftk /pdf-forms/raw/idaho.pdf dump_data_fields
的交互式 PDF 的字段数据示例:
---
FieldType: Text
FieldName: Employer Name Address incl zip
FieldNameAlt: Employer (Name & Address incl. zip)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: CarrierAdministrator Claim Number
FieldNameAlt: Carrier/Administrator Claim Number
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Jurisdiction
FieldNameAlt: Jurisdiction
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Jurisdiction Claim No
FieldNameAlt: Jurisdiction Claim No.
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Employers Location Address if different
FieldNameAlt: Employer’s Location Address (if different)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Claims Admin Name Address Phone Number
FieldNameAlt: Claims Admin (Name, Address & Phone Number)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
临时 FDF 文件如下所示:
%FDF-1.2 1 0 obj<</FDF<<
/Fields[
<</T(Employer Name Address incl zip)/V(Name Test Submit)>>
<</T(CarrierAdministrator Claim Number)/V(Carrier/Administrator Claim Number)>>
<</T(Jurisdiction)/V(Jurisdiction)>>
<</T(Jurisdiction Claim No)/V(Jurisdiction Claim No.)>>
<</T(Employers Location Address if different)/V(Employer’s Location Address (if different))>>
<</T(Claims Admin Name Address Phone Number)/V(Claims Admin Name)>>
] >> >>
endobj
trailer
<</Root 1 0 R>>
%%EOF
下面是我正在使用的代码示例,如果有帮助的话:
$data = [
'Employer Name Address incl zip' => $entry[15], // multiline blank
'CarrierAdministrator Claim Number' => $entry[93], // multiline filled
'Jurisdiction' => $entry[95], // single line filled
'Jurisdiction Claim No' => $entry[96], // single line filled
'Employers Location Address if different' => $entry["98.1"], // multiline filled
'Claims Admin Name Address Phone Number' => $entry[155], // multiline blank
];
$pdf = new PdfForm('/pdf-forms/raw/idaho.pdf', $data);
$pdf->save('/pdf-forms/flat/idaho.pdf');
$pdf->download();
寻找某种解决方案来填充所有字段,或者至少寻找某种方法来测试为什么它不起作用。
在某些字段名称中实际上有一个双 space。
Employer Name Address incl zip
而不是 Employer Name Address incl zip
Claims Admin Name Address Phone Number
而不是 Claims Admin Name Address Phone Number
更正后的 FDF:
%FDF-1.2
1 0 obj <<
/FDF <<
/Fields [ <<
/T (Employer Name Address incl zip)
/V (Name Test Submit)
>> <<
/T (CarrierAdministrator Claim Number)
/V (Carrier/Administrator Claim Number)
>> <<
/T (Jurisdiction)
/V (Jurisdiction)
>> <<
/T (Jurisdiction Claim No)
/V (Jurisdiction Claim No.)
>> <<
/T (Employers Location Address if different)
/V (Employer’s Location Address \(if different\))
>> <<
/T (Claims Admin Name Address Phone Number)
/V (Claims Admin Name)
>> ]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
我正在使用 PDFtk 从表单条目中填写交互式 PDF,但在使用 fill_form
命令合并 FDF 文件后,PDF 中的某些字段仍然空白。它似乎影响了一些多行字段 (FieldFlags: 4096
),但不是所有多行字段。
这是来自 pdftk /pdf-forms/raw/idaho.pdf dump_data_fields
的交互式 PDF 的字段数据示例:
---
FieldType: Text
FieldName: Employer Name Address incl zip
FieldNameAlt: Employer (Name & Address incl. zip)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: CarrierAdministrator Claim Number
FieldNameAlt: Carrier/Administrator Claim Number
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Jurisdiction
FieldNameAlt: Jurisdiction
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Jurisdiction Claim No
FieldNameAlt: Jurisdiction Claim No.
FieldFlags: 0
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Employers Location Address if different
FieldNameAlt: Employer’s Location Address (if different)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
FieldType: Text
FieldName: Claims Admin Name Address Phone Number
FieldNameAlt: Claims Admin (Name, Address & Phone Number)
FieldFlags: 4096
FieldValue:
FieldJustification: Left
---
临时 FDF 文件如下所示:
%FDF-1.2 1 0 obj<</FDF<<
/Fields[
<</T(Employer Name Address incl zip)/V(Name Test Submit)>>
<</T(CarrierAdministrator Claim Number)/V(Carrier/Administrator Claim Number)>>
<</T(Jurisdiction)/V(Jurisdiction)>>
<</T(Jurisdiction Claim No)/V(Jurisdiction Claim No.)>>
<</T(Employers Location Address if different)/V(Employer’s Location Address (if different))>>
<</T(Claims Admin Name Address Phone Number)/V(Claims Admin Name)>>
] >> >>
endobj
trailer
<</Root 1 0 R>>
%%EOF
下面是我正在使用的代码示例,如果有帮助的话:
$data = [
'Employer Name Address incl zip' => $entry[15], // multiline blank
'CarrierAdministrator Claim Number' => $entry[93], // multiline filled
'Jurisdiction' => $entry[95], // single line filled
'Jurisdiction Claim No' => $entry[96], // single line filled
'Employers Location Address if different' => $entry["98.1"], // multiline filled
'Claims Admin Name Address Phone Number' => $entry[155], // multiline blank
];
$pdf = new PdfForm('/pdf-forms/raw/idaho.pdf', $data);
$pdf->save('/pdf-forms/flat/idaho.pdf');
$pdf->download();
寻找某种解决方案来填充所有字段,或者至少寻找某种方法来测试为什么它不起作用。
在某些字段名称中实际上有一个双 space。
Employer Name Address incl zip
而不是Employer Name Address incl zip
Claims Admin Name Address Phone Number
而不是Claims Admin Name Address Phone Number
更正后的 FDF:
%FDF-1.2
1 0 obj <<
/FDF <<
/Fields [ <<
/T (Employer Name Address incl zip)
/V (Name Test Submit)
>> <<
/T (CarrierAdministrator Claim Number)
/V (Carrier/Administrator Claim Number)
>> <<
/T (Jurisdiction)
/V (Jurisdiction)
>> <<
/T (Jurisdiction Claim No)
/V (Jurisdiction Claim No.)
>> <<
/T (Employers Location Address if different)
/V (Employer’s Location Address \(if different\))
>> <<
/T (Claims Admin Name Address Phone Number)
/V (Claims Admin Name)
>> ]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF