0

I have a form with 100's of fields along with radio and check-box. What will be the best way to create PDF from it. Here is the link to my form 'http://182.71.22.42/ccs/'. I have used 'JSPDF' library but it just prints text only in PDF not any input field. I have also tried 'TCPDF' but I don't know how to show check-box and radio buttons and also I have to do css for 'TCPDF' also. Because TCPDF does not pick any HTML form css..

Please help me with this. Thanks in advance.

2 Answers2

0

I like pdftk (PDF Tool Kit). It's fairly easy to use. There is a GUI, but there's also a command line tool -- which is obviously what you'll want to use. You'll install the pdftk program on your server, and run it from your PHP script.

PDFTK General Tutorial

  1. Firstly, a blank PDF file should reside on your server. The empty fields should be labeled such that you can reference them.

  2. When a user inputs information via your form, the data should be sanitized and inserted into an FDF (Forms Document File).

  3. Once you have your FDF completed, in your PHP script, run:

exec('pdftk blank.pdf fill_form new.fdf output finished.pdf');

Where blank.pdf is the empty PDF, new.fdf is the FDF you just created, and finished.pdf is the name of the file you want pdftk to create for you.

Community
  • 1
  • 1
kittykittybangbang
  • 2,380
  • 4
  • 16
  • 27
  • Thanks for your replies .I found solution in TCPDF to show checkboxes. Just use different images, one for checked checkbox and other for unchecked. – Web Expert Sep 03 '15 at 20:43
0

Thanks for your replies .I found solution in TCPDF to show checkboxes. Just use different images, one for checked checkbox and other for unchecked