我对如何使用 pdftk 在单个文本框中填充多个值感到困惑。
到目前为止我尝试了什么:
$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
但是我想替换两个值 <<ProjectAddress>><<ProjectCityState>>
对于 ex:, 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.
关于php - PDFtk 在单个 PDF 表单文本字段中填充多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42478951/