Page numbers

1,470 views
Skip to first unread message

balkrishna.rawool

unread,
Mar 17, 2011, 9:25:31 AM3/17/11
to Flying Saucer Users
I am using Flying Saucer R7final.

What I want is that the generated pdf document should have page
numbers, but these numbers should not appear on certain pages (at the
beginning and at the end). Right now the generated document has number
on all pages. Is there an API by which I can restrict these numbering.

Any help in this regard is most welcome.

Thanks,
Balkrishna Rawool

Peter Brant

unread,
Mar 18, 2011, 11:11:48 AM3/18/11
to flying-sa...@googlegroups.com
If you can upgrade to R8, you can use CSS3's margin boxes for this.
R8 also supports custom CSS properties to divide a document into
chunks with independent page numbering.

Pete

balkrishna.rawool

unread,
Mar 18, 2011, 11:23:15 AM3/18/11
to Flying Saucer Users
Hi Peter,

Thanks for reply.

Two things:

1. I tried upgrading to R8. But when I do that the page numbers do not
appear on any pages except the first one.
Below are some code snippets:

html file:
<div id="footer" style=""> Page <span id="pagenumber"/> of <span
id="pagecount"/> </div>

css file:
#footer {
font-size: 90%; font-style: italic;
position: absolute; top: 0; left: 0;
-fs-move-to-flow: "footer";
}
#pagenumber:before {
content: counter(page);
}
#pagecount:before {
content: counter(pages);
}

2. Could you provide me with any example (code) for "custom CSS
properties to divide a document into
chunks with independent page numbering with R8".

Thanks a lot,
Balkrishna.
> > Balkrishna Rawool- Hide quoted text -
>
> - Show quoted text -

Peter Brant

unread,
Mar 24, 2011, 9:24:14 AM3/24/11
to flying-sa...@googlegroups.com
R8 uses CSS3 margin boxes vs. the custom properties that R7 used. See
http://www.w3.org/TR/css3-page/#margin-boxes for more info.

Regarding page sequences, any block element with the CSS rule

-fs-page-sequence: start

will start a new page numbering sequence.

Pete

balkrishna.rawool

unread,
Mar 27, 2011, 5:01:08 AM3/27/11
to Flying Saucer Users
Hi Pete,

Thanks for reply.
With the pointers you gave I could get the conditional page numbering
sequence started.
I still have couple of issues:

1. The CSS rule '-fs-page-sequence: start ' starts new sequence. But
pages before that also have numbers. What I want is that page numbers
do not appear on first few and last few pages of the document. Is
there any way to suppress these numbers?

2. Now I cannot make use of 'counter(pages)' to show total number of
pages. Is there a different way to do it?

Thanks a lot,
Balkrishna.


On Mar 24, 3:24 pm, Peter Brant <peter.br...@gmail.com> wrote:
> R8 uses CSS3 margin boxes vs. the custom properties that R7 used. Seehttp://www.w3.org/TR/css3-page/#margin-boxesfor more info.
> >> - Show quoted text -- Hide quoted text -

Peter Brant

unread,
Mar 27, 2011, 6:21:19 AM3/27/11
to flying-sa...@googlegroups.com
Regarding (1), you can use position: running(...) for that.
Documentation here http://www.w3.org/TR/css3-gcpm/#running-elements

Regarding (2), counter(pages) is always relative to the current page
sequence, but maybe you can accomplish what you want with running
elements and a custom initial page number in ITextRenderer. It would
be relatively straightforward to add a custom counter(-fs-total-pages)
counter too. If you do work up a patch for that, it will definitely
be applied.

Pete

Reply all
Reply to author
Forward
0 new messages