Trigger window.print() two or more times
<p>I have a page which contains, let's say 3 divs which I want to print seperatly - and I can do that manually. However, the webapp is running Chrome with silent printing and I need to print these 3 divs, in 3 seperate print jobs. A print stylesheet is not what I need - 3 SEPERATE PRINT JOBS IS NEEDED...</p>

<p>So I need to trigger window.print() multiple times. The best and only solution I have come up with is trigger my print function 3 times, like this:</p>

<pre><code>setTimeout(function() { printContent('print1', 'letter'); }, 0);

setTimeout(function() { printContent('print2', 'letter'); }, 1);

setTimeout(function() { printContent('print3', 'letter'); }, 2);
</code></pre>

<p>However, somethimes Chrome fails to run the function three times. How can I make sure, that the function is triggered corretly 3 times in a row?</p>

<p>Should anyone find it interesting, my printContent() function is this:</p>

<pre><code>function printContent(divContent, divClass) {
    var divContent = $('#' + divContent).html();
    $('#print-spooler-box').html('').addClass(divClass).html(divContent);
    window.print();
    $('#print-spooler-box').removeClass(divClass);
}
</code></pre>
