Hi

Sorry I'm new to using iText so my apologies if the below code is an 
abomination to all things iText.
My problem is simple, when there is only one page to render the pdf is 
created flawlessly. However
when I go to a second page the ColumnText seems to be appearing at the 
very bottom of the second
page with the rest of the text(presumably rendered off-screen, the 
document will only ever be one or
two pages).

I'm using an onStartPage event to render a background image(covering the 
entire page) to the
DirectContentUnder. If I'm doing anything particularly weird I'd 
appreciate the feedback on
how to improve the code/technique.

Regards
Kevin

The Abomination follows....
-----------------------------------------------------
document.open();
PdfContentByte topLayer = writer.getDirectContent();
try {
    topLayer.setFontAndSize(BaseFont.createFont(), 9f);
} catch (IOException e) {
    log.error(e);
}
    
ColumnText column = new ColumnText(topLayer);

column.setSimpleColumn(HORIZONTALINDENT, VERTICALINDENT, 
document.right() - HORIZONTALINDENT, document.top() - VERTICALINDENT, 
0f, Element.ALIGN_CENTER);

for(int i=0; i < getNumPages(); i++)
{
    float lineSpacing = 9f;
    Font textfont = new Font(Font.COURIER , 9f, Font.NORMAL);
    Paragraph paraText= new Paragraph( getPage(i).toString(), textfont);
    
    paraText.setLeading(lineSpacing);
    paraText.setSpacingBefore(0f);
    paraText.setSpacingAfter(0f);
    column.addElement(paraText);
    column.go();

    if(i+1 < getNumPages()){
        document.newPage();
        topLayer.reset();
    }
}
document.close();



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to