Save form results as PDF

Hard question.

I have a very long form when a user writes a lot of data. I need to save the form for future reading (pdf, html or even jpg will do), but I need to save it with the data that the user wrote. This must be done when submitting the form.

I know that this will not be possible only with PHP, but is it possible with a little help from javascript-ajax?

I cannot offer the user to print the page, and I need to save the view without any other input from the user (next to submit).

Any ideas?

EDIT:

in a nutshell,

Is it possible to create a pdf file from this page without sending data? Is there a way that fpdf (or others) could โ€œreadโ€ and save what is currently on the screen, just like the โ€œprintโ€ function?

Imagine a long looong form with a โ€œsave as PDFโ€ button that saves the current page (with user input) WITHOUT submitting the form ....

+4
source share
3 answers

Take a look at the stream: Which of the best PDF libraries for PHP?

The solutions listed above include:

Another possible solution would be to convert HTML to PDF to PHP: HTML to PDF to PHP

+1
source

You can see: http://php.net/manual/en/book.pdf.php and http://www.tcpdf.org/

Hope this helps you. Thanks.

+1
source

If you want to switch from form data to PDF, then one of the methods you can try is to get the provided data, create an HTML document and convert this document to PDF. You will not have to send HTML to the user (although you could), because you will use HTML only for formatting purposes. Paste the HTML into a variable and then parse it through one of many HTML to PDF converters.

0
source

Source: https://habr.com/ru/post/1338285/


All Articles