barryvdh / laravel-snappy

Laravel Snappy PDF
MIT License
2.63k stars 290 forks source link

[ISSUE] Content not fit A4 page #472

Closed c-delouvencourt closed 2 years ago

c-delouvencourt commented 2 years ago

Hello,

I have an issue where my content does not fit the A4 page, see this example : Screenshot

In my blade view I use : https://github.com/cognitom/paper-css for sizing multiple pages in A4 format with margins

In Laravel : $pdf = \Barryvdh\Snappy\Facades\SnappyPdf::loadView('estimation.rapportEstimation', []) ->setOption('disable-smart-shrinking', true) ->setOption('page-size', 'A4') ->setOption('margin-bottom', 0) ->setOption('margin-left', 0) ->setOption('margin-right', 0) ->setOption('margin-top', 0) ->setOption('zoom', 1.5) ->setOption('enable-javascript', true) ->setOption('javascript-delay', 5000) ->setOption('debug-javascript', true);

Can you help me please ? Or how can I zoom with option to fit html content to pdf page please ? Because changing zoom does nothing ?

Versions : WKHTMLTOPDF : 0.12.5 (debian 10) "barryvdh/laravel-snappy": "^1.0.0"

c-delouvencourt commented 2 years ago

Fixed by setting the content height in pixels (cm and mm not supported)

hassanhgfd commented 1 year ago

I solved this by using pixel sizes, the transformation is from 150ppt size to pixel. for 150ppt A4 => width: 1240px; height: 1754px;