I have had some trouble trying to vertically center a cell.  Reading this 
mailing list it seems that I am not the only one.  In some cases the problem 
was solved by using the PdfPTable class rather than the Table class, however I 
have only been using PdfPTable.

Below is a sample program demonstrating my problem.  Notice that the first 
column seems to be vertically aligned to the bottom.  In fact no matter how I 
try to align the first cell it always seems to align to the bottom.

- mike


        File file = new File( "c:/temp/test.pdf" );
        Document document = new Document();
        PdfWriter.getInstance( document, new FileOutputStream( file ) );
        document.open();
        PdfPTable pdfTable = new PdfPTable( 2 );

        Chunk chunk = new Chunk( "Caddyshack" );
        chunk.setAnchor( "http://en.wikipedia.org/wiki/Caddyshack"; );
        Font font = chunk.getFont();
        font.setColor( Color.BLUE );
        font.setStyle( com.lowagie.text.Font.UNDERLINE );
        chunk.setFont( font );
        PdfPCell cell = new PdfPCell();
        cell.addElement( chunk );
        cell.setVerticalAlignment( Element.ALIGN_MIDDLE );
        pdfTable.addCell( cell );

        pdfTable.addCell( "Chevy Chase" );
        document.add( pdfTable );
        document.close();



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to