将utf-8字符将FDF/XFDF表单展平为PHP的PDF [英] Flatten FDF / XFDF forms to PDF in PHP with utf-8 characters
问题描述
我的情况:
- 具有formfields的PDF模板:template.pdf
- 一个XFDF文件,其中包含要填充的数据:fieldData.xfdf
现在我需要将这些文件合并到&扁平化. pdftk可以轻松地在php中完成这项工作:
Now I need to have these to files combined & flattened. pdftk does the job easily within php:
exec("pdftk template.pdf fill_form fieldData.xfdf output flatFile.pdf flatten");
不幸的是,这不能完全支持utf-8. 例如:西里尔字母和希腊字母被打乱.我为此使用了Arial,并使用了unicode字符集.
Unfortunately this does not work with full utf-8 support. For example: Cyrillic and greek letters get scrambled. I used Arial for this, with an unicode character set.
- 如何整理扁平化unicode文件?
- 是否还有其他提供unicode支持的pdf工具?
- pdftk是否有我缺少的unicode开关?
由于这个问题已经有9个月没有解决了,所以我决定为此悬赏.如果在pdftk中有赞助功能或错误修正的选项,我很乐意捐赠.
EDIT 1: As this question has not been solved for more then 9 month, I decided to start a bounty for it. In case there are options to sponsor a feature or a bugfix in pdftk, I'd be glad to donate.
我不再从事此项目,因此无法验证新答案.如果有人遇到类似的问题,我很高兴他们能支持我.
EDIT 2: I am not working on this project anymore, so I cannot verify new answers. If anyone has a similar problem, I am glad if they can respond in my favour.
推荐答案
不幸的是,UTF-8字符编码不适用于源.xfdf文件中非ASCII字符的十进制或十六进制引用. PDFTK 1.44版.
Unfortunately, UTF-8 character encoding does not work neither with decimal nor hexadecimal references of non-ASCII characters in source .xfdf file. PDFTK v. 1.44.
这篇关于将utf-8字符将FDF/XFDF表单展平为PHP的PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!