How to create editable Pdf form in php

Rohan Kumar picture Rohan Kumar · Jul 12, 2013 · Viewed 22k times · Source

I have a simple form and I want to make it editable in pdf using php. But the pdf is creating the form but I can't edit and submit it, any reason or I can't edit pdf using php?

My code is

<?php
    define('_MPDF_PATH','/');
    include("mpdf.php");

    $html = '
        <form action="test.php">
          <input type="text" id="name" value="name" />
          <input type="reset" name="reset" value="Reset" />
          <input type="submit" name="submit" value="Submit" /> 
        </form>';

    $mpdf=new mPDF('c'); 

    $mpdf->default_lineheight_correction = 1.2;

    // LOAD a stylesheet
    $stylesheet = file_get_contents('mpdfstyletables.css');
    $mpdf->WriteHTML($stylesheet,1);    // The parameter 1 tells that this is css/style only and no body/html/text
    $mpdf->SetColumns(2,'J');
    $mpdf->WriteHTML($html);
    $mpdf->Output('test.pdf','D');//
    exit;
?>

I'm using mPDF Example Url and Form Example

Answer

Rahul Seth picture Rahul Seth · Aug 5, 2014

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/