Try this. My previous example did work when I got the latest version.
This however does not:

// Margins and the first paragraph are a bit different
iTextSharp.text.Document document = new
iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 36f, 36f, 36f,
36f);

System.IO.MemoryStream ms = new MemoryStream();
iTextSharp.text.pdf.PdfWriter writer =
iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms);

document.Open();                        

iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent;
iTextSharp.text.pdf.ColumnText ct1 = new
iTextSharp.text.pdf.ColumnText(cb);

Paragraph p1 = new
Paragraph("a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na
\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na");
Paragraph p2 = new Paragraph("blah blah blah. blah blah blah. blah blah
blah. blah blah blah. blah blah blah. blah blah blah. blah blah blah.
blah blah blah. blah blah blah. blah blah blah. blah blah blah. blah
blah blah. blah blah blah. blah blah blah. blah blah blah. ");

PdfPTable p = new PdfPTable(1);
p.SplitLate = false;
p.WidthPercentage = 100f;
p.SetWidths(new int[] {100});

PdfPCell c1 = new PdfPCell();
c1.UseDescender = true;
c1.UseAscender = true;
c1.UseBorderPadding = true;
c1.PaddingLeft = 3f;
c1.PaddingRight = 3f;
c1.PaddingTop = 0;
c1.PaddingBottom = 0;
c1.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER;
c1.BorderWidth = 3f;
c1.AddElement(p1);

PdfPCell c2 = new PdfPCell();
c2.UseDescender = true;
c2.UseAscender = true;
c2.UseBorderPadding = true;
c2.PaddingLeft = 3f;
c2.PaddingRight = 3f;
c2.PaddingTop = 9f;
c2.PaddingBottom = 9f;
c2.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER;
c2.BorderWidth = 3f;
c2.AddElement(p2);

p.AddCell(c1);
p.AddCell(c2);

I attached the output I am getting showing the content being dropped.

Thanks,

-Mitch

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Paulo Soares
Sent: Monday, August 07, 2006 4:55 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] SplitLate Problem/Question

Works for me. I attach what I got using the latest itextsharp.

Paulo

----- Original Message -----
From: "Mitch Freed" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, August 07, 2006 11:09 PM
Subject: [iText-questions] SplitLate Problem/Question


I have a PdfPTable which I have specified the SplitLate property to
false on. I have a scenario where I have 2 rows. The first row spans the
entire page, thus the second row will display on the second page. If
SplitLate is set to true, this works fine. If SplitLate is set to false,
I lose some or all of the content of the second row. One property that
affects this problem is the cell padding. If I set the padding to 0, all
the content will display fine. If I set the padding to say 10, some or
all of the content will not get displayed.

I need to have a table that has rows that can split right on the page
break and that will work with SplitLate set to false and that can
specify padding w/out losing cell content. Any ideas?

BTW, I am using iTextSharp -- a June CVS version.

Thanks,
Mitch Freed


Example:

iTextSharp.text.Document document = new
iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 21.6f, 21.6f,
21.6f, 21.6f);

System.IO.MemoryStream ms = new MemoryStream();
iTextSharp.text.pdf.PdfWriter writer =
iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms);

document.Open();

iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent;
iTextSharp.text.pdf.ColumnText ct1 = new
iTextSharp.text.pdf.ColumnText(cb);

Paragraph p1 = new
Paragraph("a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na
\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
Paragraph p2 = new Paragraph("blah blah blah. blah blah blah. blah blah
blah. blah blah blah. blah blah blah. blah blah blah. blah blah blah.
blah blah blah. blah blah blah. blah blah blah. blah blah blah. blah
blah blah. blah blah blah. blah blah blah. blah blah blah. ");

PdfPTable p = new PdfPTable(1);
p.SplitLate = false;

PdfPCell c1 = new PdfPCell();
c1.UseDescender = true;
c1.UseAscender = true;
c1.UseBorderPadding = true;
c1.PaddingLeft = 3f;
c1.PaddingRight = 3f;
c1.PaddingTop = 3f;
c1.PaddingBottom = 3f;
c1.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER;
c1.BorderWidth = 3f;
c1.AddElement(p1);

PdfPCell c2 = new PdfPCell();
c2.UseDescender = true;
c2.UseAscender = true;
c2.UseBorderPadding = true;
c2.PaddingLeft = 3f;
c2.PaddingRight = 3f;
c2.PaddingTop = 0f;
c2.PaddingBottom = 0f;
c2.Border = iTextSharp.text.Rectangle.TOP_BORDER |
iTextSharp.text.Rectangle.BOTTOM_BORDER |
iTextSharp.text.Rectangle.LEFT_BORDER |
iTextSharp.text.Rectangle.RIGHT_BORDER;
c2.BorderWidth = 3f;
c2.AddElement(p2);

p.AddCell(c1);
p.AddCell(c2);
p.SetWidths(new float[] {100});

ct1.AddElement(p);

int status = 0;
while ((status & iTextSharp.text.pdf.ColumnText.NO_MORE_TEXT) == 0)
{
   ct1.SetSimpleColumn(document.Left, document.Bottom, document.Right,
document.Top);
   status = ct3.Go();

   if ((status & iTextSharp.text.pdf.ColumnText.NO_MORE_TEXT) == 0)
     document.NewPage();
}

document.Close();



------------------------------------------------------------------------
--------


>
------------------------------------------------------------------------
-
> Using Tomcat but need to do more? Need to support web services,
security?
> Get stuff done quickly with pre-integrated technology to make your job

> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


------------------------------------------------------------------------
--------


> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 

Attachment: test.pdf
Description: test.pdf

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to