Title: RE: Leading in cell of PdfPTable

Set the cell with a fixed or minimum height and draw the text in a PdfPCellEvent.

Best Regards,

Paulo Soares

    -----Original Message-----

    From:   Jaladurgam, Ramana [SMTP:[EMAIL PROTECTED]

    Sent:   Tuesday, December 02, 2003 17:53

    To:     Paulo Soares; [EMAIL PROTECTED]

    Subject:        RE: Leading in cell of PdfPTable

    I am required to re-produce the the visio text block. The visio text block looks like this:

    ���

    The line spacing�is� 1.2 times the height of the previous line. I am trying to achieve this through a single cell PdfPTable.

    I am not getting correct results for mixed fonts.

    How to achieve this ?

    Regards
    Ramana.JV.

      -----Original Message-----
      From: Paulo Soares [mailto:[EMAIL PROTECTED]]
      Sent: Tuesday, December 02, 2003 11:53 AM
      To: Jaladurgam, Ramana; [EMAIL PROTECTED]
      Subject: RE: Leading in cell of PdfPTable

      That's a bizarre requirement and it's not supported (why should it be?).
      You'll have to draw the text yourself.

      Best Regards,
      Paulo Soares

      -----Original Message-----
      From:�� Jaladurgam, Ramana [SMTP:[EMAIL PROTECTED]
      Sent:�� Tuesday, December 02, 2003 17:36
      To:���� [EMAIL PROTECTED]
      Cc:���� Paulo Soares
      Subject:������� Leading in cell of PdfPTable

      Hello,
      � I wanted to set the leading in PdfPCell as 1.2 times the height of the
      previous line.
      � I am using the following code to do that:
      ���������� public static void main(String[] args)
      ��� {
      ������� Document document = new Document();
      ������� try
      ������� {

      ����������� PdfWriter lPdfWriter = PdfWriter.getInstance(document , new
      FileOutputStream("TextBlock.pdf"));
      ����������� document.open();
      ����������� PdfPTable lPdfPTable = new PdfPTable(1);

      lPdfPTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

      lPdfPTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
      ����������� lPdfPTable.getDefaultCell().setBorderWidth(1);
      ����������� lPdfPTable.getDefaultCell().setFixedHeight(100);
      ����������� lPdfPTable.setTotalWidth(100);
      ����������� lPdfPTable.getDefaultCell().setLeading(0 , 1.2f);
      ����������� Phrase p = new Phrase();
      ����������� //p.setLeading(5.0f);
      ����������� p.add(new Chunk("First Chunkg",
      FontFactory.getFont(FontFactory.HELVETICA , 24, Font.ITALIC, new
      java.awt.Color(255, 0, 0))));
      ����������� //p.add(Chunk.NEWLINE);
      ����������� p.add(new Chunk("Sec Chunk",
      FontFactory.getFont(FontFactory.HELVETICA, 8, Font.ITALIC, new
      java.awt.Color(255, 0, 0))));
      ����������� p.add(new Chunk("Third Chunk",
      FontFactory.getFont(FontFactory.HELVETICA, 8, Font.ITALIC, new
      java.awt.Color(255, 0, 0))));
      ����������� lPdfPTable.addCell(p);
      ����������� lPdfPTable.writeSelectedRows(0 , -1 , 200 , 600 ,
      lPdfWriter.getDirectContent());
      ������� }
      ������� catch (DocumentException de)
      ������� {
      ����������� System.err.println(de.getMessage());
      ������� }
      ������� catch (IOException ioe)
      ������� {
      ����������� System.err.println(ioe.getMessage());
      ������� }
      ������� document.close();

      ��� }

      �But the last line doesn't have the required leading. It appears that the
      line leading is depending on the font size of the last chunk written in that
      line. What I wanted is to set the leading to 1.2 times the height of the
      previous line. How to achieve this?
      �I am also attaching the output pdf file..

      Regards
      Ramana.JV.


      ****************************************************************************
      This email may contain confidential material.
      If you were not an intended recipient,
      Please notify the sender and delete all copies.
      We may monitor email to and from our network.
      **************************************************************************** << File: TextBlock.pdf >>

    ****************************************************************************

    This email may contain confidential
    material. If you were not an intended recipient,
    Please notify the sender and delete all copies.
    We may monitor email to and from our network.

    �***************************************************************************

    � << File: Outlook.bmp >>

Reply via email to