I've got my quotation built out, the last thing I am having difficulty with, if the notes for the quotation expand onto more than one page it looks like the below, I would rather put a page-break should the containing div get beyond X pixels in height, I've tried with some JavaScript, but that doesn't appear to work, any ideas gratefully appreciated:
https://1drv.ms/i/s!Agzx0BwwHhY32v8-D03w7FBebMq_bQ?e=WLYVTV
<script>
document.addEventListener("DOMContentLoaded", function () {
const targetDiv = document.getElementById("notes");
function checkHeightAndInsertBreak() {
if (targetDiv.offsetHeight >= 200) {
const pageBreak = document.createElement("div");
pageBreak.style.pageBreakAfter = "always"; // For print view
pageBreak.style.display = "block";
targetDiv.appendChild(pageBreak);
}
}
checkHeightAndInsertBreak();
});
</script>