Php PDFtk在单个PDF表单文本字段中填充多个值
我不太清楚如何使用pdftk在单个文本框中填充多个指针值 到目前为止我所尝试的:Php PDFtk在单个PDF表单文本字段中填充多个值,php,mysql,arrays,pdftk,fdf,Php,Mysql,Arrays,Pdftk,Fdf,我不太清楚如何使用pdftk在单个文本框中填充多个指针值 到目前为止我所尝试的: $dataFields = `pdftk $pdf_path dump_data_fields`; --- FieldType: Text FieldName: <<ProjectName>> FieldNameAlt: <<ProjectName>> FieldFlags: 0 FieldJustification: Left --- FieldType: Tex
$dataFields = `pdftk $pdf_path dump_data_fields`;
---
FieldType: Text
FieldName: <<ProjectName>>
FieldNameAlt: <<ProjectName>>
FieldFlags: 0
FieldJustification: Left
---
FieldType: Text
FieldName: *<<ProjectAddress>><<ProjectCityState>>*
FieldNameAlt: <<ProjectAddress>><<ProjectCityState>>
FieldFlags: 0
FieldJustification: Left
我可以用这个命令获取数据字段
此示例的输出:
$dataFields = `pdftk $pdf_path dump_data_fields`;
---
FieldType: Text
FieldName: <<ProjectName>>
FieldNameAlt: <<ProjectName>>
FieldFlags: 0
FieldJustification: Left
---
FieldType: Text
FieldName: *<<ProjectAddress>><<ProjectCityState>>*
FieldNameAlt: <<ProjectAddress>><<ProjectCityState>>
FieldFlags: 0
FieldJustification: Left
---
字段类型:文本
字段名:
FieldNameAlt:
字段标志:0
字段对齐:左
---
字段类型:文本
字段名:**
FieldNameAlt:
字段标志:0
字段对齐:左
但是有两个值我想用一些其他值替换
,例如:,21 jump street NY
。我可以替换单个值,但如何从数组中动态替换多个值。好的。所以我找到了解决问题的方法。我所做的:
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.
好的,我找到了解决问题的办法。我所做的:
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.
您还可以添加
|grep FieldName
以更快地一步过滤名称。您还可以添加|grep FieldName
以更快地一步过滤名称。