Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we generate the page number dynamically? #39

Open
iamtekson opened this issue Apr 21, 2020 · 2 comments
Open

Can we generate the page number dynamically? #39

iamtekson opened this issue Apr 21, 2020 · 2 comments

Comments

@iamtekson
Copy link

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

@0xflotus
Copy link

0xflotus commented Jun 5, 2020

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.

@jarodium
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants