Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] insert a table into a header/footer?

Stephane PEYVEL

2005-06-17


Hello,

I have some problem to insert a table into the footer of a PDF document.
When i insert it, the table appears in the PDF body of the document (top of the
document in fact).
Someone have a solution?

regards,
Stephane Peyvel

PS:
please see here the source code i use:

public class MainClass {

  public static void main(String[] args) {
    System.out.println("START OF TEST");
    long start = System.currentTimeMillis();
    try {        
       Document document = new Document(PageSize.A4, 50, 50, 50, 50);
       File file = new File("d:/test.pdf");
       FileOutputStream out = new FileOutputStream(file);
       PdfWriter.getInstance(document, out);
       document.addAuthor("author");
       document.addSubject("subject");
       document.setHeader(null);
       
       Paragraph paragraph = new Paragraph();
       Table table = new Table(2);
       table.setBorderWidth(1);
       table.setBorderColor(Color.BLACK);
       table.setPadding(0);
       table.setSpacing(0);
       Cell cell = new Cell("TEST TEST");
       table.addCell(cell);
       table.setAlignment(Table.ALIGN_CENTER);
       paragraph.add(table);
       
       HeaderFooter footer = new HeaderFooter(paragraph, false);
       footer.setAlignment(Paragraph.ALIGN_CENTER);
       
       document.setFooter(footer);
       
       document.open();
       document.add(new Paragraph("This is a simple test."));
       document.close();
    } catch (Exception e) {
       e.printStackTrace();
    } finally {
       long end = System.currentTimeMillis();
       System.out.println("END OF TEST - "+(end - start)+"ms");
    }
   
  }
}




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.