barryvdh/laravel-snappy

DPI 300 footer/header issues

uvolos opened this issue · 1 comments

uvolos commented

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

DPI 300
Снимок экрана 2023-07-18 в 13 20 13

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();
uvolos commented

UPD:
wkhtmltopdf issue wkhtmltopdf/wkhtmltopdf#3378