I am assuming the content of 2 divs always fits on an A4 page without changing font size.
Based on CSS to set A4 paper size.
Added css to add page break every 2 divs.
I used printing to pdf file in Firefox as a quick printer free way to check layout.
<!DOCTYPE html>
<html>
<head>
<style>
/*
based on
https://stackoverflow.com/a/30345808/1692270 *
then added css to add page break every 2 items
*/
/*ie last in every group of 2*/
/*page break every 2nd item */
div:nth-of-type(2n-0) {
background: red;
page-break-after: always;
}
/*ie 1st in every group of 2*/
div:nth-of-type(2n-1) {
background: blue;
}
body {
background: rgb(204,204,204);
}
page[size="A4"] {
background: white;
width: 21cm;
height: 29.7cm;
display: block;
margin: 0 auto;
margin-bottom: 0.5cm;
box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
}
@media print {
body, page[size="A4"] {
margin: 0;
box-shadow: 0;
}
}
</style>
</head>
<body>
<div>The first div.</div>
<div>The second div.<br>more stuff here</div>
<div>The third div.</div>
<div>The fourth div.</div>
<div>The fifth div.</div>
<div>The sixth div.</div>
<div>The seventh div.</div>
<div>The eight div.</div>
<div>The ninth div.</div>
<div>The 10th div.</div>
<div>The 11th div.</div>
<div>The 12 div.</div>
<div>The 13 div.</div>
<div>The 14 div.</div>
<div>The 15 div.</div>
<div>The 16th div.</div>
<div>The 17th div.</div>
</body>
</html>