I 开发者_高级运维have tried googleing this but can't seem to find an answer.
I have a client that has hundreds of PDF files, each of them have a form with any number of text-fields within them... it could range anywhere from 2 text-fields to 30 text-fields... that is an unknown.
What I need to do is read the PDF file, find all of the text-fields (including field names) within the PDF file so that I can dynamically generate a HTML form that an user will complete which then populates the PDF form.
How can I get a list of text fields and their names within a PDF document using PHP?
There are few tools to work on PDFs that are natively written in PHP.
You might however be able to run the pdftk
binary to accomplish this task:
$fields = `pdftk input.pdf dump_data_fields`;
Not tried since I don't have a PDF with forms handy. But supposely you get a textual result list as described here: http://www.cs.unb.ca/~bremner/blog/posts/filling_in_forms_with_pdftk/
精彩评论