Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
HTML to pdf: jump to new page when container content overflows

I am using handlebar to generate an HTML file, and then use puppeteer to change it to pdf. Right now I have a handlebars template of structure like this

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/css?family=Roboto"
    />
    <style>
    ...
      
      .body_container {
        display: flex;
        flex-wrap: wrap;
        flex-direction: column;
        max-height: 19.334cm;
        border: 0.25px solid;
        border-color: #b8b8b8;
        font-size: 14px;
      }

    </style>
    
  </head>

  <body>
   
      <div class="body_container">
        ...
      </div>
      <div style="page-break-before: always"></div>
    ...
  </body>
</html>

The page should look like this enter image description here

There're some divs(pink) inside this body container(in black). The amount of content in each div is dynamic, so there is a possibility that it could overflow.

What I hope to do is whenever the body divs have a height exceeding the max height of the body container, it should jump to a new page and make another body container, then write in there.

Is it possible to do so? Any help/hints would be appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!