title: wkhtmltopdf page-break-before div have whitespace in new page, div not shown
body: <p>I am generating a PDF with wkhtmltopdf from a generated html-file.
  I use the latest wkhtmltopdf version (0.12.2.0) for <em>windows</em>.</p>
  
  <p>My additional wkhtmltopdf parameters are:</p>
  
  <pre><code>--zoom 1.0
  --encoding "UTF-8"
  --page-offset -1
  --footer-html "C:\tmp\footer.html"
  --header-html "C:\tmp\header.html"
  --header-spacing 10
  --footer-spacing 10 toc
  --xsl-style-sheet "C:\tmp\toc.xsl"
  </code></pre>
  
  <p>In the <em>footer.html, header.html, toc.xsl</em> are nothing defined about page-breaks.
  The HTML is valid. Every tag which is opened is closed in the right order. I've checked it twice.</p>
  
  <p>If I insert a page-break-<strong>after</strong> div all works fine. But I need a page-break-<strong>before</strong> too. If I insert a page-break-<strong>before</strong> div it breaks the page too, but on the new page there is a block of white space and the div is not shown.</p>
  
  <pre><code>&lt;div style='page-break-before: always; height: 10px; width: 100%; background-color: red;'&gt;
   &lt;span style='color:rgb(0, 0, 0)'&gt;OOO&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It doesn't matter if this style properties are set or not: "height: 10px; width: 100%;"</p>
  
  <p>The two pages should look like:</p>
  
  <pre><code>+--------------------+
  |                  1 |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |                    |
  |                    |
  |                    |
  +--------------------+
  -
  +--------------------+
  |                  2 |
  |   OOOOOOOOOOOOOO   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |                    |
  |                    |
  |                    |
  |                    |
  +--------------------+
  </code></pre>
  
  <p>But they look like (div not shown and a large whitespace on next page):</p>
  
  <pre><code>+--------------------+
  |                  1 |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |                    |
  |                    |
  |                    |
  +--------------------+
  -
  +--------------------+
  |                  2 |
  |                    |
  |                    |
  |                    |
  |                    |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |   xxxxxxxxxxxxxx   |
  |                    |
  +--------------------+
  </code></pre>
  
  <p>The x-es are the placeholders for the text. The O-s are the placeholder for my div. </p>
  
  <p>I've already tried this from answer 1. <a href="https://stackoverflow.com/questions/27058472/wkhtmltopdf-page-break-after-have-whitespace">wkhtmltopdf page-break-after have whitespace</a> The whitespace is already there.</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>In some other of my generated PDFs there are some texts over the other. I don't know why wkhtmltopdf does sometimes some whitespace and sometimes it puts one text over the other but if I set the css attribute:</p>
  
  <pre><code>overflow-x: visible !important;
  </code></pre>
  
  <p>in my CSS file. Then in the PDF there is no more senseless whitespace and there is no more one text over the other, but then it makes <em>no more page-breaks</em>.</p>
  
  <hr>
  
  <p><strong>Solution:</strong></p>
  
  <p>The main problem was, that the html I received from an other tool to put it in the wkhtmltopdf-tool was so complex with many div blocks and useless html-tags, that the wkhtmltopdf-tool made this error. With a cleaned html it works perfect.</p>