I found it.

 A line from my first post:  add(new PdfPCell(t));  <<<----- NOT GOOD!!!!!!


I was putting my table INTO a cell and then placing THAT cell in the
table.  I must say, this does not work.

I was thinking Element when I did that.


In other words:

I went from this -  (you can ignore most of the semantics)

 PdfPTable t = new PdfPTable (1);
        t.setTotalWidth(W);
        //t.setKeepTogether(true);
        //t.setWidthPercentage(100);

        PdfPCell cell = new PdfPCell (new Phrase(label, DOC_FONT));
        cell.setFixedHeight(H * .85f);
        //cell.setBorder(Rectangle.NO_BORDER);
        t.addCell(cell);

     /*   if (post.length() > 4 || post.length() < 12) {

            BarcodePostnet pnbc = new BarcodePostnet();

            pnbc.setCode(post);

            cell = new PdfPCell(pnbc.createImageWithBarcode(cb, null,null));
            cell.setFixedHeight(H * .15f);
            //cell.setBorder(Rectangle.NO_BORDER);

            t.addCell(cell);
        }*/

        add(new PdfPCell(t));    <<---NOT GOOD!!!!

    }

/ * ---------------- NEXT METHOD --------------------- */

    public void add (PdfPCell cell){     //I was calling this method above

        /* adds the actual cell to the table  */
        /* Every add() calls this method */

        cell.setFixedHeight(H);

        cell.setNoWrap(NO_CELL_WRAP);

        cell.setPaddingLeft(CELL_LEFT_PADDING);

        cell.setVerticalAlignment(VALIGNMENT);
        cell.setHorizontalAlignment(HALIGNMENT);

        if (!DEBUG) cell.setBorder(Rectangle.NO_BORDER);  //show table
borders in DEBUG mode

        how_many++;  //total amount of labels
        counter++;  // 'int counter' keeps track of how many times
                    // this method is called within a range of X (X = ACROSS)

        table.addCell("");
        table.addCell(cell);
        if (counter == ACROSS) table.addCell("");  //at the end

        if (counter == ACROSS) counter = 0;  //if at the end reset the
counter

    }


/***/

To this -

PdfPTable t = new PdfPTable (1);
        t.setTotalWidth(W);
        //t.setKeepTogether(true);
        //t.setWidthPercentage(100);

        PdfPCell cell = new PdfPCell (new Phrase(label, DOC_FONT));
        cell.setFixedHeight(H * .85f);
        //cell.setBorder(Rectangle.NO_BORDER);
        t.addCell(cell);                     /// NOT MUCH CHANGED HERE

     /*   if (post.length() > 4 || post.length() < 12) {

            BarcodePostnet pnbc = new BarcodePostnet();

            pnbc.setCode(post);

            cell = new PdfPCell(pnbc.createImageWithBarcode(cb, null,null));
            cell.setFixedHeight(H * .15f);
            //cell.setBorder(Rectangle.NO_BORDER);

            t.addCell(cell);
        }*/

        add(t);    <<---CHANGED

    }



//now calls this method that adds the nested table without placing it in a
cell first. (the way its supposed to be done :)
public void add (PdfPTable nt){
        /* adds the provided table to THE table  */

        how_many++;  //total amount of labels
        counter++;  // 'int counter' keeps track of how many times
                    // this method is called within a range of X (X = ACROSS)

        table.addCell("");
        table.addCell(nt);
        if (counter == ACROSS) table.addCell("");  //at the end

        if (counter == ACROSS) counter = 0;  //if at the end reset the
counter


    }


WORKS GREAT!!!

Thanks for all your time and hope this helps someone.

Sean



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to