Hi,

I currently am building a PDF through Java using iText 5.1.1 which has a
table and for each table there are two columns.  The first column of each
row is a rectangular color and the second column of each row is text.  All
of this is being generated within a loop.

Now, the table builds fine with everything, but for some reason, an entire
page is being inserted before.  The only thing on that page is the last
color created by the loop and it's in the very bottom left of the screen.  I
have no idea why this is happening, but I believe the origin of something is
0,0, right?  Is there a way to make this not show up in the bottom left on a
brand new page?  Here is some of my code:

                        float[] colsWidth = {0.75f, 18f)
                        PdfPTable table = new PdfPTable(colsWidth);
                        ......

                        // START OF LOOP
                        PdfContentByte canvas = writer.getDirectContent();
                        PdfTemplate template = canvas.createTemplate(5,
10);

                            canvas.setColorStroke(new BaseColor(new
Color(red, green, blue)));
                            canvas.rectangle(0, 0, 5, 10);
                            canvas.setRGBColorFill(red, green, blue);
                            canvas.fillStroke();

                            canvas.saveState();
                            canvas.restoreState();

                            template.add(canvas);

                            Image img = Image.getInstance(template);

                            Phrase n1 = new Phrase("");

                            Chunk c1 = new Chunk (img, 0, 0);
                            n1.add(c1);

                            PdfPCell legendElemCell1 = new PdfPCell(n1);

                            ....

                            legendElemCell1.setBorder(0);
                            legendElemCell2.setBorder(0);
                            table.addCell(legendElemCell1);
                            table.addCell(legendElemCell2);
                           // END LOOP
                           ..........

                           curCompChapter.add(table);



Thank you,
Mike
------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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

Reply via email to