使用PHP获取PDF文件中的字段 [英] Get fields in a PDF file using PHP

查看:186
本文介绍了使用PHP获取PDF文件中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PHP找出PDF文件中的字段名称?

How can I find out the name of the fields in a PDF file using PHP?

我唯一想到的就是将PDF文件转换为HTML,但这听起来实在是太过分了.

The only thing I can think of is converting the PDF file to HTML, but that really sounds like overkill.

我的最终目标是生成一个FDF文件(对此我很满意)来填充我无法控制的PDF文件的字段,因此我不知道我需要使用哪些字段名称使用.

My end goal is to generate an FDF file (this bit I'm happy with) to populate the fields of a PDF file which I don't have control over, so I don't know what field names I need to use.

推荐答案

如果您愿意使用命令行工具,请参见

If you are willing to use a command line tool, see

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

pdftk命令可以从PDF表单文件生成FDF文件.

The pdftk command can generate an FDF file from a PDF form file.

pdftk formfile.pdf generate_fdf

pdftk formfile.pdf generate_fdf

form字段是输出中看起来像的部分

The form fields are the portion of the output that looks like

...
<< /T(f1-1) /V(text of field) >>
<< /T(f1-2) /V(text of another field) >>
...

这篇关于使用PHP获取PDF文件中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆