title: Convert HTML into PDF break by page
body: <p>Recently I'm working on a function which involve html template.</p>
  
  <p>What this function does is to generate a dynamic template, and convert it into an pdf. </p>
  
  <p>So far, i manage to do it like this</p>
  
  <pre><code>var output = '';
  async.each(input.contentInfo, function(component, next) {
      renderTemplate(component, function(err, result){ //compile input and template together
          output = output + result; //merge all component's html source code together
          next();
      });
  }, function(err) {
      conversion({        //phantom-html-to-pdf function from npm module
          html: output,
          paperSize: {
              format: 'A8', 
              orientation: 'landscape',
              margin: 0,
              headerHeight: 0,
              footerHeight: 0
          }
      }, function(err, pdf) {
          var output = fs.createWriteStream('output.pdf');
          pdf.stream.pipe(output);
      });
  });
  </code></pre>
  
  <p>Assuming everything works fine over here because I did't show any error checking around the example.</p>
  
  <p>Now, the <code>output</code> variable would be something like this</p>
  
  <pre><code>&lt;div style="page-break-before: always;"&gt;
      &lt;div style="position:absolute;left:100;top:100;&gt;
          Page 1 Content
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style="page-break-before: always;"&gt;
      &lt;div style="position:absolute;left:100;top:100;&gt;
          Page 2 Content
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The result I expected to see when the html convert to PDF, would be 2 pages due to the <code>page-break</code> CSS, but in this case, it doesn't. But if using the same output without the <code>position: absolute</code> CSS, it work as I expected but the UI is not right.</p>
  
  <p>Is there any solution for this situation to achieve both of the requirement?</p>
  
  <p>Any help to this will be appreciated and sorry if I explain the situation bad. Thanks.</p>