Vunnam Satyanarayana, Noida wrote:
> Hi, 
> 
> I am working on the project which deals with the pdf files. I am not 
> able to read the page number from the existing pdf file.
> 
> Is there option in itext to read the page number?

It depends.

[1] Normally you use getImportedPage(reader, pagenumber);
and page number is the number of the page. That's the
easy answer in case this is a stupid question.

[2] However, sometimes pages have page labels, for instance
the first page is page i, the second page page ii,
the third page is page iii, then the fourth page is page 1,
the fifth page is page 2, and so on.
If this is the case, you can use
PdfPageLabels.getPageLabels(reader);
and you'll get an array of Strings, for instance:
{"i", "ii", "iii", "1", "2", "3", "4"}
That's the answer in case this is an intelligent question.

[3] Finally, if none of the above is what you meant, I fear
we have to file the question under the 'ignorance' category.

If the page number is just present somewhere on a page
and it doesn't correspond with the actual page number in
the document [1], nor with the page label of that page [2],
then what you are asking for is impossible. In that case,
the page number is just a glyph drawn somewhere on a canvas.
It could be anywhere. There's no way for you to know if this
or that glyph on that page is a page number or part of the
actual content of that page. It's simply impossible, with
iText AS WELL AS with any other library to retrieve that
number "programmatically".
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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