0

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.

Console Error

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.

Shuichi
  • 1
  • 1
  • What part of the code you provided throws that error? I can't seem to find it based on the screenshot you attached – Togira Jun 23 '22 at 07:17
  • Hi Togira, sorry. Found out the error. Apparently, another team member updated the main css file of the page. Closing this question. – Shuichi Jun 24 '22 at 11:08

0 Answers0