Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate PDF file full size #515

Open
Dominik-Kapitan opened this issue Sep 26, 2023 · 1 comment
Open

How to generate PDF file full size #515

Dominik-Kapitan opened this issue Sep 26, 2023 · 1 comment

Comments

@Dominik-Kapitan
Copy link

Dominik-Kapitan commented Sep 26, 2023

Hi.

In laravel 10 I'm using wkhtmltopd library to generate pdf document.

The problem is when I try generate content in full width of ducument, top and sides. Some reason there is always white border on the right side
Screenshot from 2023-09-26 12-29-38

This is my html code that I use to generate document:

<!DOCTYPE html>
<html style="margin: 0; padding: 0; background-color: #fd7e14">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Title</title>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org//face/open-sauce-one" type="text/css"/>
<meta name="author" content="name author">
<style media="all">
    html {
        margin: 0 !important;
        padding:0 !important;
        border:0 !important;
        outline:0 !important;
    }
    body {
        margin: 0 !important;
        padding:0 !important;
        border:0 !important;
        outline:0 !important;
    }
</style>
</head>

<body>
   Test Content
</body>
</html>

And this is my PHP render code:

$pdf->setPaper('A4', 'portrait')->setOptions([
                'margin-left' => 0,
                'margin-right' => 0,
                'margin-top' => 0,
                'margin-bottom' => 0,
            ])->save($pathToStore);

How can I remove that white space?

@jonnywilliamson
Copy link
Contributor

I'm literally just browsing here, but have you tried a negative margin right? Maybe -1 or -2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants