PHP Classes

What is the best PHP pdf forms extract class?: Get all the fields in the PDF form

Recommend this page to a friend!
  All requests RSS feed  >  What is the best PHP pdf forms extrac...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

What is the best PHP pdf forms extract class?

A request is featured when there is no good recommended package on the site when it is posted. Edit

Picture of Joseph Asir Raja by Joseph Asir Raja - 6 years ago (2016-05-11)

Get all the fields in the PDF form

This request is clear and relevant.
This request is not clear or is not relevant.

+2

I want to get all the fields in the PDF form.

So if we extract the PDF fields as an array I can map the fields with the another HTML form fields which is generated by other plugin and enter the data from the Web site to PDF fields and save as another PDF file.

Note I only only need pure PHP coding not a library to use and API like the php library for PDFTK.

  • 2 Clarification requests
  • 2. Picture of Christian Vigh by Christian Vigh - 6 years ago (2016-05-12) Reply

    I have developed a class that extracts text contents from PDF files (http://www.phpclasses.org/package/9732-PHP-Extract-text-contents-from-PDF-files.html) ; this could be a basis for extracting form definitions.

    However, I will not be as optimistic as you, Manuel : the Adobe PDF specification is 1300 pages long, not including lengthy technical notes about particular points. Regarding the number of surprises I got (and still have) with a so simple task as extracting text contents, I will be cautious regarding form data extraction.

    Joseph, if you want, I can have a look at this topic but I'll need some sample PDF files containing forms for that.

    That could solve your first issue (read a PDF file and extract form definitions to generate a form in HTML).

    However, your second issue (writing html form contents back to a pdf file) will be more tricky. There are free solutions in pure php that allow you to create pdf files (such as fpdf or tcpdf) but, as far as I know, none of them will allow you to take a pdf template having form definitions, supply the form field values and write the modified contents to an output file.

    Maybe in this case you could consider solutions that transform html to pdf ?

    • 1. Picture of Manuel Lemos by Manuel Lemos - 6 years ago (2016-05-12) Reply

      There are some PDF parser classes that can extract PDF text and other objects. I am not sure if those classes could be evolved to extract the details of form objects. It may not be so hard once you have the base PDF document parser.

      Ask clarification

      Recommend package
      : 
      :