node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

Multiple Pages Docs On separate Pages

Open shivdhwaj opened this issue 7 years ago • 8 comments

Currently, whole HTML doc is printed out what if we need to print separately docs pages in one pdf but different pages

shivdhwaj avatar Apr 06 '18 10:04 shivdhwaj

I also face the same issue, When I have multiple html content to be shown separately on different pdf pages. I can't find any solution.

sanketdhoble avatar Apr 06 '18 10:04 sanketdhoble

same here, any solutions?

SenninSensei avatar Apr 10 '18 01:04 SenninSensei

Not yet, once done will post it

shivdhwaj avatar Apr 10 '18 04:04 shivdhwaj

im using the css rule page-break-after: always for multi page, i hope it works for u too

SenninSensei avatar Apr 11 '18 22:04 SenninSensei

In CSS use:

.pb_before { page-break-before: always !important; } /* Breaks page before of element */
.pb_after  { page-break-after: always !important; } /* Breaks page after of element */
.pbi_avoid { page-break-inside: avoid !important; } /* Avoid breaks page in element */

In JS use camel case:

pb_before: { pageBreakBefore: 'always !important' } /* Breaks page before of element */
pb_after:  { pageBreakAfter: 'always !important' } /* Breaks page after of element */
pbi_avoid: { pageBreakInside: 'avoid !important' } /* Avoid breaks page in element */

jmruiza avatar Apr 12 '18 14:04 jmruiza

Thanks guys, page-break works well.

sanketdhoble avatar Apr 13 '18 11:04 sanketdhoble

Not working for me. I wonder if it is because I'm using flex and grid

vasco3 avatar Dec 21 '20 15:12 vasco3

It worked for me

felipeborba-dev avatar Jan 15 '22 18:01 felipeborba-dev