我很困惑如何使用pdftk在单个文本框中填充muiltiple值。
到目前为止我尝试了什么:
$dataFields = `pdftk $pdf_path dump_data_fields`;
我可以使用此commnad获取数据字段。
示例OUtPUT:
---
FieldType: Text
FieldName: <<ProjectName>>
FieldNameAlt: <<ProjectName>>
FieldFlags: 0
FieldJustification: Left
---
FieldType: Text
FieldName: *<<ProjectAddress>><<ProjectCityState>>*
FieldNameAlt: <<ProjectAddress>><<ProjectCityState>>
FieldFlags: 0
FieldJustification: Left
但有两个值我想用{:1}替换<<ProjectAddress>><<ProjectCityState>>
和其他一些值:21 jump street NY
。我可以替换单个值但是如何从数组中动态替换多个值。
答案 0 :(得分:0)
好的。我找到了解决方案。我做了什么:
1)save the field data in to one .txt file
2)using command `$dataFields = `pdftk $pdf_path dump_data_fields output output.txt``;
3)after that i have converted the file data in to array. using `$data = file('output.txt');` command and explode with new line.
4)then i put condition that if the string contains`FileName:` keyword and make new array.
5)and then compate it with my array and check.