KnpLabs / snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Home Page:https://knplabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to display a complete A4 HTML page?

liuyong888 opened this issue · comments

The html:
Since I can't display my HTML code completely here, I changed the file extension to TXT.
a4.txt

Chrome Display(Scale by 50%):
image

Generatoer code:
I use Laravel-Snappy.
barryvdh/laravel-snappy: v0.4.8
$file_path = './a4.html';

$pdf = \PDF::loadFile($file_path)
    ->setPaper('a4')
    ->setOptions([
        'encoding' => 'utf-8',
        'margin-bottom' => 0,
        'margin-left' => 0,
        'margin-right' => 0,
        'margin-top' => 0,
    ]);
return $pdf->save($pdf_name)->inline($pdf_name);`

The generated PDF:
PDF file are not the same as HTML file!

image
How do I ensure that the red part of my HTML is fully displayed in PDF!
Plz!
@akerouanton
@alexpozzi

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.