Open uvolos opened 11 months 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![Снимок экрана 2023-07-18 в 13 19 48](https://github.com/barryvdh/laravel-snappy/assets/12811951/40edb52c-18af-4193-9f8a-f43e73df231e)
DPI 300![Снимок экрана 2023-07-18 в 13 20 13](https://github.com/barryvdh/laravel-snappy/assets/12811951/de899a2f-e2a8-45e7-a99e-05d19805fe37)
Example: