I am using the following code to get page number for a node. However, for
some cases I am not getting page number because PG entry is available for a
few nodes. is there any other I can page number for the some cases?

....Get page number
if (getITxtDictionary().contains(PdfName.PG)) {

                        PdfIndirectReference pageRef  =
getITxtDictionary().getAsIndirectObject(PdfName.PG);
                        System.out.println("page no ="+ getPageNumber
(pageRef));
   
                        if page number is not determined, I get child nodes
and recursively call get page number , Until I get page number.                 
    
}

   

public int getPageNumber(PdfIndirectReference pageRef) {
                if (pageRef == null) return -1;
                for (int i=0; i<reader.getNumberOfPages(); ++i) {
                        if (reader.getPageOrigRef(i+1).getNumber() == 
pageRef.getNumber())
                                return i+1;
                }
                return -1;
}



 
-- 
View this message in context: 
http://old.nabble.com/page-number-determination-tp27218494p27218494.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to