One question about the Reading of Pagenumber using iText

View: New views
2 Messages — Rating Filter:   Alert me  

One question about the Reading of Pagenumber using iText

by Vunnam Satyanarayana, Noida :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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?

 

Thanks & Regards

satya

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------
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
iText-questions@...
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

Re: One question about the Reading of Pagenumber using iText

by 1T3XT info :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
iText-questions@...
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