Neel
Neel

Reputation: 9880

Wkhtmltopdf Snappy - Set Page Borders for all Pages

I am using Laravel-Snappy for generating pdfs with wkhtmltpdf. I want to add a border in all pages that are created in the pdf file. At the moment, I have added this to the css:

body.pdf {
    border: 1px solid #000;
}

My pdf html is like this:

<html>
    <head>
        <title>{{ $title }}</title>
    </head>

    <body class="pdf">

      .....

    </body>
</html>

With the above css, the border shows fine if it is a single page pdf. However, when it has multiple pages, the border breaks at the bottom of the first page and no more border shows from page 2 onwards after the page-break. I also read the documentation and I dont think there is an feature to add borders using setOption().

Is there a way to resolve it so the border appears in all pages when pdf is generated?

Upvotes: 0

Views: 3655

Answers (1)

Unni K S
Unni K S

Reputation: 375

Please take look at here, you can find all available options available including border.

You didn't mentioned how you used page break.

I am using this way

div.page
    {
        page-break-after: always;
        page-break-inside: avoid;
    }

Working fine for me

Upvotes: 1

Related Questions