H
H
Hy_ok2016-12-19 11:20:36
PHP
Hy_ok, 2016-12-19 11:20:36

How to save form data to PDF and paste them in the right places in this file in php?

there is a form where we fill in the fields, after we collect all this data, how to send them and save them in the right lines in a pdf file and then download it? Tell me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Egorov, 2016-12-19
@hy_ok

  1. we prepare an html file (with design and other unchanged content), in which we put markers like ###numberOfOrders### and the like in the right places
    A pdf is generated from php, something like this code:
    function makePdf($filename) {
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $wkhtmltopdf = '"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"';
        } else {
            $wkhtmltopdf = '/usr/local/bin/wkhtmltopdf';
        }
        $make = "$wkhtmltopdf $filename.html $filename.pdf";
        shell_exec($make);
    }

    I tried many PHP generators - they all generate crookedly (or the layout is complicated). And the specified utility generated everything correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question