我正在尝试在剩余页面尺寸小于下一个div尺寸时添加分页符。 为此,我尝试使用该代码
var pageSize = 1030;
var clientHeight = -100;
var selector_ids = ['career_sum','exp_cal','certi_cal', 'curri_cal', 'port_cal', 'ref_cal'];
selector_classes.forEach(function(element) {
clientHeight = document.getElementById(element).offsetHeight + clientHeight;
var remain = pageSize - clientHeight;
var div_size = document.getElementById(element).offsetHeight;
if (remain < div_size) {
document.getElementById(element).style.pageBreakAfter = "always";
}
if(clientHeight > pageSize) {
document.getElementById(element).style.width = "1030px";
}
});
始终保持