I am using iText to generate PDFs from database records.
The psuedo code looks like this:
for (i=1;i<39;i++){
get database field
doc.add(new Chunk(label, fonts[1]);
doc.add(new Chunk(value, fonts[2]);
doc.add(Chunk.NEWLINE);
if(i == 17){
doc.add("Sample Graphic(s)", fonts[1]);
doc.add(Chunk.NEWLINE);
get image from database as img
img.setAlign(Image.ALIGN_CENTER);
doc.add(img)
doc.add(Chunk.NEWLINE);
}
}
This works after a fashion but, because the size of the text from the first 17
fields is totally random, the image sometimes will not fit on the current page.
iText seems to then fill the current page withthe following field text and puts
the image at the top of the next page ( that is, wher eit next fits).
How an I force the text for fields 18 to 38 to come after the image regardless
of whether or not there is a page throw for the image.
Ideally, I would like the "Sample Graphic(s)" heading to always be on the same
page as the image.
Cheers and thanks,
Stephen
--
=============================================================================
Stephen Davies Consulting P/L Voice: 08-8177 1595
Adelaide, South Australia. Fax : 08-8177 0133
Records & Collections Management. Mobile:040 304 0583
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php