Open uvolos opened 1 year ago
With DPI 96 all looks fine With DPI 300 header/footer moving to the center of page
DPI 96
DPI 300
Example:
$pdf = \App::make('snappy.pdf.wrapper'); $pdf->setOptions([ 'disable-smart-shrinking' => true, 'page-size' => 'A4', 'orientation' => 'portrait', 'dpi' => 300, // 96 ]); function htm($content) { return "<!DOCTYPE html><html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head><body>$content</body></html>"; } $pdf->setOption('header-html', htm('<div style="background: red;">HEADER</div>')); $pdf->setOption('footer-html', htm('<div style="background: blue;">FOOTER</div>')); $pdf->loadHTML(htm('<div style="background: green">CONTENT</div>')); $response = $pdf->download();
UPD: wkhtmltopdf issue https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3378
With DPI 96 all looks fine With DPI 300 header/footer moving to the center of page
DPI 96
DPI 300
Example: