title: Page break problems with html2pdf.js
body: <p>I'm using <a href="https://github.com/eKoopmans/html2pdf.js" rel="nofollow noreferrer">html2pdf.js</a> in an Angular app in order to save large document (CSS formated HTML with images) to a PDF. I need to force page breaks at some points (before each field having <code>newPage</code> class). This is simplified version of my code:</p>
  <pre><code>@ViewChild('report', { static: false }) reportElement: ElementRef;
  
  const opt = {
          filename: 'test.pdf',
          image: {type: 'jpeg', quality: 0.98},
          html2canvas:  {scale: 3},
          pagebreak: {before: '.newPage', avoid: ['h2', 'h3', 'h4', '.field']},
          jsPDF: {unit: 'mm', format: 'a4', orientation: 'portrait'}
      };
  
  html2pdf().from(this.reportElement.nativeElement).set(opt).save();
  </code></pre>
  <p>This works fine, but there is an issue with &quot;soft&quot; (non-forced) page breaks after a few pages in PDF - page breaks are being &quot;missed&quot; by a few pixels, getting worse at each upcoming page. The issue was reported on <a href="https://github.com/eKoopmans/html2pdf.js/issues/227" rel="nofollow noreferrer">package's github</a>, but the proposed dirty fix is not applicable to the current package version.</p>
  <p>Any idea how to bypass this issue?</p>