Reputation: 11
I'm using PagedJS to add footers and headers to the html templates that we convert to PDF in our website. The code's been working fine for a week until this morning when this error keeps popping up.
This is my code:
<script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
<script>
class MyHandler extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
beforeParsed(content) {
// Chapters Counter
$("head").append(`
<style>body{counter-set: chapters ${content.querySelectorAll(".chapter").length};}</style>
`);
}
afterPageLayout(pageFragment, page){
//if pageFragment does not have a page class, delete it
if(pageFragment.querySelectorAll(".page").length == 0){
console.log("Hiding page!");
console.log(pageFragment);
pageFragment.setAttribute("style", "display:none;");
}
}
}
Paged.registerHandlers(MyHandler);
</script>
Any help would be greatly appreciated.
Upvotes: 1
Views: 812
Reputation: 1
The problem on my side was this css rule in the direct html wrapper
break-after: page;
after removing it the error was gone
Upvotes: 0