Javier Del Amo wrote:
> Ok, sorry.

You see: I'm not the only one having a problem with the way
you are asking questions.

> I´m using PdfWriter.

With document.add(object); I presume.
You really should be more specific!

> I want to save the page number of some paragraph 
> I´ve insert into the document.

You are creating an index, we know that from previous questions.

> Then, when I finish the document I will 
> create a PdfPTable and insert the content of the table (texto + page 
> number), in page 2. I hope I explain my problem.

Suppose you have 50 pages.
Now you want the index to be added on page 2.
However: will the index take more than one page?
Will this affect the page numbers of the other pages,
or are you allowed to number the index i, ii, iii, iv,...
whereas the other pages are numbered 1, 2, 3, 4,...?
(As is done in the book "iText in Action").
I repeat: you really have to be more specific.

You are asking for a page number in the book, but
if you had actually done the effort of reading the
book, you would have found out that this is explained
for instance on page 431: "Reordering pages".
The example refers to the example from Chapter 4
that was already advised to you.

Note that this is one way to do it.

Another way would be to just create the actual document
(mydoc.pdf); meanwhile create another document with the
TOC (toc.pdf); and then afterwards concatenate both
documents as is done on page 443-444.

Personally, I would probably create the document, keep
track of the index but not print it, then use PdfStamper
and insertPage to insert the TOC and loop over every
page to add the page numbers. But it really depends
on the actual requirement.

In an earlier mail you were accused of being a lazy person;
your excuse was "that you are still learning". But you aren't!
You are asking us for an exact page number where you can find
code to copy. I don't call that learning!

We could say p431, but is this the best solution for you?
We don't know, maybe p443 or even another page is better.
You'll never learn what iText is about if you refuse to
read the complete book. Otherwise you risk taking the
advice of somebody who used p431 and was very happy because
it was the best solution for HIS PARTICALAR REQUIREMENT,
but it might be a horrible solution for YOUR PARTICULAR
REQUIREMENT. I said it before and I'll say it again:
the best solution depends on the exact requirements.

We've had this discussion before and it's very frustrating.
I'm saying all this because I want you to become a better
developer (in my own interest: so that you don't post half
witted questions anymore), but your latest question tells
me it's not helping. In Dutch we have a proverb: "Wat baten
kaars en bril als den uil niet zien wil." Literally translated:
"The candle and glasses are useless, if the owl doesn't want
to see." I have the feeling this applies to you, because you
have all the possible solutions at hand in the book, but you
ask us to read it, so that you don't have to search yourself
which code you can cut and paste...
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to