I am using mPDF through PHP in order to generate an exact replica PDF of an HTML page. This PDF is then being saved to the server so that it can be automatically printed for the user through PHP socket programming.
When I print preview the HTML page, it looks exactly as I would want it printed. When I convert the HTML to a PDF with mPDF, it becomes wide and distorted. I just want it to look exactly like the HTML print preview with no changes.
Here is my PHP code:
require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(); ob_start(); include 'cert.html'; $html = ob_get_contents(); ob_end_clean(); $mpdf->WriteHTML($html); $mpdf->Output();