Re: [iText-questions] yet another problem with vertical alignment
I don't see how you want to vertical align a line of text when the cell only has space for one line. Any alignment will look the same. Maybe you need PdfPCell.setUseAscender(). Paulo > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Tuesday, October 23, 2007 4:48 PM > To: itext-questions@lists.sourceforge.net > Subject: Re: [iText-questions] yet another problem with > vertical alignment > > Paulo, > > I do not want to increase the height of the row by adding new > line characters to the second cell. All I would like to do > is vertically align the first cell. If I add text only to > the first cell, instead of a Chunk, it seems to respect the > vertical alignment setting. Is there some other way to > vertically align the contents of a cell? Thanks > > - mike Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. - 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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
Re: [iText-questions] yet another problem with vertical alignment
Paulo, I do not want to increase the height of the row by adding new line characters to the second cell. All I would like to do is vertically align the first cell. If I add text only to the first cell, instead of a Chunk, it seems to respect the vertical alignment setting. Is there some other way to vertically align the contents of a cell? Thanks - mike - 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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
Re: [iText-questions] yet another problem with vertical alignment
Put a couple of \n in the second cell and see the first one align correctly. Paulo - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Monday, October 22, 2007 6:51 PM Subject: [iText-questions] yet another problem with vertical alignment >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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
[iText-questions] yet another problem with vertical alignment
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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/