paper-css icon indicating copy to clipboard operation
paper-css copied to clipboard

Can we generate the page number dynamically?

Open iamtekson opened this issue 4 years ago • 2 comments

I am looking to generate page number dynamically while printing the document. Is there any possible way to do that?

iamtekson avatar Apr 21 '20 02:04 iamtekson

I am looking to generate page number dynamically while printing the document. Is there any possible way to do that?

Yes this should be possible. It depends on you. How do you use the sections? E.g. you can initialize a Javascript variable which is incrementing with each new section or you generate the html from an external programming language and use there a loop to increment a counter which is displayed in the html.

0xflotus avatar Jun 05 '20 19:06 0xflotus

I use the following approach:

body {
    counter-reset: article;
}

article::after {
    counter-increment: article;
    content: attr(data-pageLabel) counter(article) " ";
    text-align:right;
    display: inline-block;
    position: absolute;
    bottom: 15mm;
    right: 15mm;
    font-size: 8pt;
}

`
data-pageLabel is an attribute I use in the article tag in order to have a translatable string in HTML rather than having it inside the CSS.

jarodium avatar Dec 23 '20 09:12 jarodium