Hi Paulo,

here's an example - both Java and PDF which explains the list-symbol
indentation problem.

Best regards,
Christian

On Wed, 2004-09-08 at 14:22, Paulo Soares wrote:
> Send me an example with the problem.
> 
> Best Regards,
> Paulo Soares 
> 
> > -----Original Message-----
> > From: Christian Lauer [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, September 08, 2004 1:12 PM
> > To: Paulo Soares
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [iText-questions] Support of lists in PdfPCell
> > 
> > Shouldn't the list indent for usage in PdfPCells behave 
> > exactly like direct
> > usage in the document? Currently the indent of list items when used in
> > PdfPCells is twice as big (in my test, it may vary for other indent
> > measurements) in output as when added to the document.
> > 
> > Best regards,
> > Christian
> > 
> > > The indent is the indent in the list, you can decrease it 
> > or increase it.
> > > 
> > > Best Regards,
> > > Paulo Soares 
> > > 
> > > > -----Original Message-----
> > > > From: Christian Lauer [mailto:[EMAIL PROTECTED] 
> > > > Sent: Wednesday, September 08, 2004 7:33 AM
> > > > To: Paulo Soares
> > > > Cc: iText Mailing List
> > > > Subject: RE: [iText-questions] Support of lists in PdfPCell
> > > > 
> > > > Hi Paulo,
> > > > 
> > > > indeed it works, that's really nice to see! 
> > > > 
> > > > At this point I'd really like to thank you for the great 
> > improvements.
> > > > I'm sure I haven't completely discovered all of them so far ;-)
> > > > 
> > > > I hope I can help you a bit by testing and reporting bugs.
> > > > 
> > > > This seems to be a minor one:
> > > > 
> > > > It seems that the symbol-indentation is handled 
> > differently for lists
> > > > placed in table cells. In case I add a list as element to the 
> > > > document a
> > > > symbol indent of 15 is normally OK. If I use the same indent 
> > > > for a list,
> > > > placed in a PdfPCell, the same indent of 15 is way to big, 
> > > > the half size
> > > > (7.5) looks OK here.
> > > > 
> > > > Best regards,
> > > > Christian
> > > > 
> > > > On Tue, 2004-09-07 at 11:30, Paulo Soares wrote:
> > > > > That's already supported in itextpdf.sf.net, together with 
> > > > spacing before/after and automatic leading. See 
> > PdfPCell.addElement().
> > > > > 
> > > > > Best Regards,
> > > > > Paulo Soares 
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: [EMAIL PROTECTED] 
> > > > > > [mailto:[EMAIL PROTECTED] On 
> > > > > > Behalf Of Christian Lauer
> > > > > > Sent: Monday, September 06, 2004 11:59 PM
> > > > > > To: iText Mailing List
> > > > > > Subject: [iText-questions] Support of lists in PdfPCell
> > > > > > 
> > > > > > During the past months I've received some requests for 
> > > > the UJAC print
> > > > > > module for placing stuff like lists in PdfPCells. Futhermore 
> > > > > > it would be
> > > > > > nice to be able to place more than one element in a cell, for 
> > > > > > example a
> > > > > > list of paragraphs and phrases. Is such a feature planned 
> > > > for iText in
> > > > > > the near future? 
> > > > > > 
> > > > > > Best regards,
> > > > > > Christian
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > -------------------------------------------------------
> > > > > > This SF.Net email is sponsored by BEA Weblogic Workshop
> > > > > > FREE Java Enterprise J2EE developer tools!
> > > > > > Get your free copy of BEA WebLogic Workshop 8.1 today.
> > > > > > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> > > > > > _______________________________________________
> > > > > > iText-questions mailing list
> > > > > > [EMAIL PROTECTED]
> > > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > > > > 
> > > > -- 
> > > > Christian Lauer <[EMAIL PROTECTED]>
> > > > 
> > > > 
> > > 
> > 
> > -- 
> > Superg�nstige DSL-Tarife + WLAN-Router f�r 0,- EUR*
> > Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl
> > 
> > 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idP47&alloc_id808&op=click
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-- 
Christian Lauer <[EMAIL PROTECTED]>
package ujac.test.itext;

import java.io.FileOutputStream;

import com.lowagie.text.Document;

import com.lowagie.text.Font;
import com.lowagie.text.List;
import com.lowagie.text.ListItem;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;

import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class ListTest {

  private static List buildList(float symbolIndent, Font font) {
    List list = new List(true, false, symbolIndent);
    list.add(new ListItem("One", font));
    list.add(new ListItem("Two", font));
    list.add(new ListItem("Three", font));
    list.add(new ListItem("Four", font));
    list.add(new ListItem("Five", font));
    list.add(new ListItem("Six", font));
    list.add(new ListItem("Seven", font));
    list.add(new ListItem("Eight", font));
    list.add(new ListItem("Nine", font));
    return list;
  }
  
  public static void main(String[] args) {
    
    try {
      FileOutputStream os = new FileOutputStream("test.pdf");
      Document document = new Document(PageSize.A4, 25, 25, 25, 25);
      PdfWriter documentWriter = PdfWriter.getInstance(document, os);
      
      document.open();
      Font font = new Font(Font.HELVETICA, 14);
      Paragraph para = new Paragraph("A List with symbol indent of 15, placed in the document.", font);
      para.setSpacingBefore(5);
      document.add(para);
      
      List list = buildList(15, font);
      document.add(list);

      PdfPTable table = new PdfPTable(2);
      para = new Paragraph("A List with symbol indent of 15, placed in a PdfPCell, this " +
          "indent is much bigger than the one in document.", font);
      PdfPCell cell = new PdfPCell(para);
      cell.setBorder(Rectangle.BOX);
      cell.setBorderWidth(0.5F);
      table.addCell(cell);
      
      cell = new PdfPCell(new Phrase(0.0F));
      cell.setBorder(Rectangle.BOX);
      cell.setBorderWidth(0.5F);
      list = buildList(15, font);
      cell.addElement(list);
      table.addCell(cell);
      document.add(table);

      document.close();
      documentWriter.close();
      
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  
}

Attachment: test.pdf
Description: Adobe PDF document

Reply via email to