I'm attempting to incorporate a page breaker at the conclusion of every HTML section, and here's my current code snippet:
printHtml += '<div id="#pageBraker">end of current page</div>';
$("#pageBraker").css("display","none");
$("#pageBraker").css("display","block");
$("#pageBraker").css("page-break-before","always");
Upon inspecting each part, I see end of current page
without encountering any console errors.
My queries are as follows:
1. How can I apply @media
to my pageBraker
or within my HTML?
2. Is this the correct approach for dynamic insertion?
Below is my complete code snippet:
//elemsToPrint - list of elements I want to print but with page breaker between
for (var index = 0; index < elemsToPrint.length; index++) {
printElement = elemsToPrint[index];
printHtml += $(content).parent().html();
printHtml += '<div id="#pageBraker">end of current page</div>';
$("#pageBraker").css("display","none");
$("#pageBraker").css("display","block");
$("#pageBraker").css("page-break-before","always");
//send to printer
_printElement(printHtml);
}
The main objective is to have each part (printHtml
) printed on a separate page.
I appreciate any assistance provided.