Node-html-pdf: Is there any way to make page breaks?

Created on 21 Jul 2015  路  8Comments  路  Source: marcbachmann/node-html-pdf

I'm trying to schematize a pdf, but there's no way to make page breaks.

faq

Most helpful comment

Thanks! <br><div style="page-break-after:always;"></div> worked perfectly for me.

All 8 comments

Sorry, I don't know that this css style exists. Solved page break with:

style="page-break-after:always;"

Thanks! <br><div style="page-break-after:always;"></div> worked perfectly for me.

style="page-break-after:always;" Works perfect!

you can use media queries too:

@media print {
p {page-break-inside: avoid;}
h1 {page-break-before: always;}
footer {page-break-after: always;}
}

that may give anybody reading this an idea #2018 :)

@lucdetellis you are a god!

Sorry to revive an old thread, but have any of you had any luck doing the same with css grid? page-break-after doesn't seem to work within a grid.

Hi Techies,
I am facing problem of page-break not working for table row (tr),
I have tried all above methods but no luck,
FYI ., i am using Nodejs, serverless framework having html-pdf as dependancy

if you are running into problems where "page-break-after: always;" does NOT work, then a cheap way to get around it is to install something like "merge-pdf-buffer" to merge multiple pdf buffers. It's how I solved my problem. instead of creating 1 pdf-buffer create multiple and merge them using the "merge-pdf-buffer" package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RodolfoSilva picture RodolfoSilva  路  3Comments

ZBilel picture ZBilel  路  4Comments

vivekiyer114 picture vivekiyer114  路  5Comments

adman020 picture adman020  路  5Comments

sca88 picture sca88  路  4Comments