Answer the question
In order to leave comments, you need to log in
How to print an invoice?
How to make a printing mechanism in js/php?
So far, I have this idea:
Make an invoice template in html, fill it out via php, and print it via js print(). Or how normal people do it? (making a pdf seemed a little tricky)
Answer the question
In order to leave comments, you need to log in
Making a pdf is not hard at all. Maybe I'm behind the times, but since I set myself the mpdf PHP library in 2011, I have not been worried since then. The bottom line is that you form normal HTML content as if it were a page, but do not output it with ECHO to the browser, but first turn it into a PDF file that is sent to the client with one function. Business something. It literally looks like this:
require ('mpdf.php');
$pdf = new mPDF('utf-8', 'A4');
$pdf->charset_in = 'cp1251';
$style = file_get_contents('style.css');
$pdf->WriteHTML($style, 1);
$html = " .... "; // Сюда пишите ваш <body>...</body>
$pdf->WriteHTML($html, 2);
$pdf->Output();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question