Page numbering.



  • Why am I finding it so difficult to add a page number to a page (NOT HEADER/FOOTER)
    I can't find any reference material on how to do this???



  • phantomjs doesn't have API to add page numbers to the content.

    You can try to workaround it using javascript.
    https://playground.jsreport.net/studio/workspace/B1c8HcCix/85



  • What about wkhtmltopdf? Is there a way to add page numbers there? The sample shows the watermark placement, what if I just want to output a page number in some span element? How can I track it so that it will be on every page?


  • administrators

    hi! have you tried the example mentioned in docs? does it not work for you?



  • That works but I don't want to put it in to the header for wkhtmltopdf. I'm trying to design a template that would look identical (or close) in HTML and PDF rendering.


  • administrators

    That works but I don't want to put it in to the header for wkhtmltopdf. I'm trying to design a template that would look identical (or close) in HTML and PDF rendering.

    hmm then i think you can try the same logic that the watermark, just that in your case you can change it to show page number at the right-top and instead of a watermark just render the current page wich is available from JS



  • I did mine by having a css style pageNumber on a paragrah

    function setPageNumbering()
    {
    var totalPages = $("p.pageNumber");
    $.each(totalPages, function(index, value ) {
    $(this).text("Page " + (index + StartPageCountAtPage ) + " of " + (totalPages.length + StartPageCountAtPage-1 ));
    });

    }


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.