How to create editable Pdf form in php

﹥>﹥吖頭↗ 提交于 2019-12-03 07:28:45

You can also use TCPDF. TCPDF is a free and open source software PHP class for generating PDF documents. TCPDF is the only PHP-based library that includes complete support for UTF-8 Unicode and right-to-left languages, including the bidirectional algorithm.

visit that link for more information. http://www.tcpdf.org/

What you are doing is just to print a form onto a PDF, but not to provide editable features. Your form is still non-editable. You have to use Acrobat SDK to make editable forms.

Rohan Kumar

Need to give my own answer, as @Christian gave almost correct and working URL of an example and I found this on Github for active forms but when I tried my html form with it, then it gives me error something like,

Fatal error: Call to undefined method mPDF::Error() .... mpdf\classes\mpdfform.php on line 839

After some searching I found that there is missing name attribute in the form's text field and when I added the attribute it worked well.

<input type="text" id="name" value="name" name="field_name" />

The problem not ends with this, when I submit the form then there is nothing shown in browser's console. Then I used php://input at server side and it has shown me some response, which is in FDF(forms data format) and needs to be parse to get the actual data. I din't give a try to parse it but found some useful URLS which I am sharing here,

  1. PHP: Extract fdf fields as an array from a PDF
  2. https://answers.acrobatusers.com/Parse-FDF-response-q72665.aspx
  3. PHP regex code to extract FDF data
  4. http://php.net/manual/en/ref.fdf.php

    links below

Christian

To make the fields editable, you need to add this line:

$mpdf->useActiveForms = true;

This should work for mPDF 5.3 and higher.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!