B
B
bernex2015-11-30 19:52:54
PHP
bernex, 2015-11-30 19:52:54

How to generate a table with summary headers and footers?

The essence of the task: the generation of a waybill, it is necessary that on each page the headings of the table and the amount for each page be repeated from the bottom.
If repeating headers are easy to make, then the bottom part is more difficult.
I would like to use Wkhtmltopdf, but I do not see a solution on it (
Who can suggest a simple and correct solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny Sokolov, 2015-12-10
@ArsenBespalov

What's the problem? If you have waybills generated automatically from some php script, then make the appropriate calls to generate headers and footers.
For example:

wkhtmltopdf --margin-top 35mm --margin-bottom 27mm \ 
 --margin-left 10m --margin-right 10mm \ 
 --header-html <путь,имя шапки.php> \ 
 --footer-html <путь,имя подвала.php?параметр=значение> \ 
 <путь,имя исходного файла.php?параметр=значение> \ 
 <путь, имя выходного файла.pdf>

already generate a similar line with another php, bash or any other script script.
And then glue the resulting PDF files into one.
You can glue it in different ways, here is an example in PHP using the FPDF library:
$pdffile = "Filename.pdf";
    $pagecount = $pdf->setSourceFile($pdffile);  
    for($i=0; $i<$pagecount; $i++){
        $pdf->AddPage();  
        $tplidx = $pdf->importPage($i+1, '/MediaBox');
        $pdf->useTemplate($tplidx, 10, 10, 200); 
    }

or with the help of GhostScript you can glue:
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \ 
 -sOutputFile=<имя конечного файла.pdf> \ 
 <файл1.pdf> <файл2.pdf> <файл3.pdf> <...> <файлN.pdf>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question