Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Start numbering pages with 2 instead of 1

Tags:

css

counter

In CSS, with:

@page { @top-right { content: "Page " counter(page) " of " counter(pages); } }

I can have page numbers displayed at the top of every page when the page is printed. This works great. But now, how can I make it so the page number starts with 2 instead of 1? Can I do that by modifying the CSS rule above?

like image 836
avernet Avatar asked Mar 01 '23 05:03

avernet


2 Answers

If you are using Flying Saucer (which was my case), use the following CSS:

table { -fs-table-paginate: paginate; }

It works like a charm. And Flying Saucer rocks :). Really highly recommended.

like image 113
avernet Avatar answered Apr 27 '23 10:04

avernet


Try:

@page {
    counter-increment: page;
    counter-reset: page 1;
    @top-right {
        content: "Page " counter(page) " of " counter(pages);
    }
}

using page 1 will reset the starting point of the counter. You can use any integer to start counting from. The default is 0.

like image 35
Brian Bell Avatar answered Apr 27 '23 09:04

Brian Bell