Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Can I Stop HTML Document Template Tables Splitting Between Pages?

Brad Cupp
Giga Contributor

Hello,

I am making an HTML Document Template to create a dynamic PDF. I am using primarily tables, and then filling those tables with variable values. However sometimes if the table falls on a page break, it splits the table into 2 different pages. Is there anyway to set it so a table that falls on a page break automatically moves into the next page, so the table isn't split?

 

Thanks!

1 ACCEPTED SOLUTION

Derek Sewall
Tera Expert

Hey @Brad Cupp,

I found an easier solution - this can be resolved using HTML rather than ServiceNow functionality.

Within the HTML script that you're producing, in your <table> tag, add "page-break-inside: avoid" to the style attribute.

Example: 

<table style="page-break-inside: avoid"> your content </table>

View solution in original post

2 REPLIES 2

Bhaba
Tera Expert

Hi @Brad Cupp 

Follow this article as this has worked perfectly fine for me. Generating a PDF from HTML.

If the problem still persists. Please share your code.

Hope this helps you.

Thanks

Derek Sewall
Tera Expert

Hey @Brad Cupp,

I found an easier solution - this can be resolved using HTML rather than ServiceNow functionality.

Within the HTML script that you're producing, in your <table> tag, add "page-break-inside: avoid" to the style attribute.

Example: 

<table style="page-break-inside: avoid"> your content </table>