You should at least try 2.1.7. If that doesn't work you are on your own unless 
you buy a license and support from itextsoftware. The mailing list only gives 
support to the latest release.

Paulo

________________________________
From: suresh.chennup...@judiciary.state.nj.us 
[suresh.chennup...@judiciary.state.nj.us]
Sent: Thursday, April 22, 2010 3:14 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PdfWriter.getPageNumber() is returning next page 
number when table ends at the end of page


We have portal environment setup using jdk1.4, so i cannot upgrade to latest 
release 5.0.2
Please let me know if there is any other alternative...



Paulo Soares <psoa...@glintt.com>

04/22/2010 08:07 AM
Please respond to
Post all your questions about iText here        
<itext-questions@lists.sourceforge.net>




To
        Post all your questions about iText here 
<itext-questions@lists.sourceforge.net>
cc

Subject
        Re: [iText-questions] PdfWriter.getPageNumber() is returning        
next        page number when table ends at the end of page







What happens if you use the latest release 5.0.2?

Paulo

________________________________
From: suresh.chennup...@judiciary.state.nj.us 
[suresh.chennup...@judiciary.state.nj.us]
Sent: Thursday, April 22, 2010 12:58 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PdfWriter.getPageNumber() is returning next page 
number when table ends at the end of page


I am using 2.1.3 version.



"Paulo Soares" <psoa...@glintt.com>
04/21/2010 06:50 PM
Please respond to
Post all your questions about iText here        
<itext-questions@lists.sourceforge.net>


To
        "Post all your questions about iText here" 
<itext-questions@lists.sourceforge.net>
cc

Subject
        Re: [iText-questions] PdfWriter.getPageNumber() is returning next       
 page number when table ends at the end of page









Are you using the latest release?

Paulo
----- Original Message -----
From: 
suresh.chennup...@judiciary.state.nj.us<mailto:suresh.chennup...@judiciary.state.nj.us>
To: 
itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>
Sent: Wednesday, April 21, 2010 5:49 PM
Subject: [iText-questions] PdfWriter.getPageNumber() is returning next page 
number when table ends at the end of page
I am trying to display mutiple tables in a single PDF and display page X of Y
at the end of each page.
X, Y should reset for every new table(Basically every new table should start
with a new page.)
Each table can vary and span accross multiple pages.

I don't have problem while tables end in the middle of page(1 page of
multiple pages).
The problem comes when the table size matches page size.

If a table size is approximately equal to page size.
it displays page 1 of 2, when it has only one page.

For tables ending in the middle of page, if it has 3 pages, page numbers are
displayed correctly as
1 of 3 , 2 of 3 , 3 of 3. But when table size ends at the end of page, if
there is 1 page, still it display 1 of 2.

Please note, the number of data tables is dynamic .

public class DocumentEventListener implements PdfPageEvent {
      PdfTemplate m_Template;
      BaseFont m_BaseFont;
      PdfContentByte m_Cb;


      public void onEndPage(PdfWriter writer, Document arg1) {
              try {

                      final int page = writer.getPageNumber();
                      String text = "Page " + page;
                      m_BaseFont = BaseFont.createFont(BaseFont.HELVETICA, 
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                      m_Cb = writer.getDirectContent();

                      if(m_Cb!=null){
                              m_Cb.beginText();
                              m_Cb.setFontAndSize(m_BaseFont, 8);
                              
m_Cb.showTextAligned(PdfContentByte.ALIGN_RIGHT,text,410,20,0);
                              m_Cb.endText();
                              m_Cb.addTemplate(m_Template, 352.3f, 20);
                      }
              } catch (DocumentException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
              } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
              }

      }

      public void createNewTemplate(PdfWriter arg0){

              m_Cb = arg0.getDirectContent();
              m_Template = m_Cb.createTemplate(85,140);


      }


      public void fillOutTemplate(PdfWriter arg0) {
              try {
              // arg0.reorderPages(null);
                      m_BaseFont = BaseFont.createFont(BaseFont.HELVETICA, 
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                      m_Template.beginText();
                      m_Template.setFontAndSize(m_BaseFont, 8);
                      String text = "of " + (arg0.getPageNumber() );
                      m_Template.showTextAligned(PdfContentByte.ALIGN_LEFT, 
text, 65, 0, 0);
                      m_Template.endText();
              } catch (DocumentException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
              } catch (IOException e) {
                      // TODO Auto-generated catch block++
                      e.printStackTrace();
              }
      }

}



****************************************************



                      //Creating template for printing Page X of Y at the end 
of page
                      ((DocumentEventListener) 
writer.getPageEvent()).createNewTemplate(writer);


                      document.add(dataTableX);

                      document.add(dataTableY);

                      //Filling template for printing Page X of Y at the end of 
page
                      ((DocumentEventListener) 
writer.getPageEvent()).fillOutTemplate(writer);




Please let me know, if any one has faced similar problem before.

Thanks
Suresh 
Chennupati------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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/
________________________________
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this 
message.------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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/


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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