- Home
- Forum
- ASP.NET Web Forms (Classic)
- Text is overlapping
Text is overlapping
Hi, in my code the PdfLayoutType.Paginate don't work fine. In foreach loop I've very large text but the new bottoms bounds is wrong and the text is overlapping.
Thank you
This is the code:
......
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
RectangleF bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
PdfTextLayoutResult result = element.Draw(page, bounds, layoutFormat);
element.Font = Font_Regular14;
element.StringFormat = SF_Titolo;
element.Text = _myText;
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
result = element.Draw(page, bounds, layoutFormat);
foreach (DataRow Dr in Dt.Rows)
{
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Bold11;
element.StringFormat = SF_Titolo;
element.Text = Dr["obb"].ToString();
result = element.Draw(page, bounds, layoutFormat);
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Regular11;
element.StringFormat = SF_Testo;
element.Text = Dr["dispo"].ToString();
result = element.Draw(page, bounds, layoutFormat);
}
Thank you
This is the code:
......
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
RectangleF bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
PdfTextLayoutResult result = element.Draw(page, bounds, layoutFormat);
element.Font = Font_Regular14;
element.StringFormat = SF_Titolo;
element.Text = _myText;
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
result = element.Draw(page, bounds, layoutFormat);
foreach (DataRow Dr in Dt.Rows)
{
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Bold11;
element.StringFormat = SF_Titolo;
element.Text = Dr["obb"].ToString();
result = element.Draw(page, bounds, layoutFormat);
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Regular11;
element.StringFormat = SF_Testo;
element.Text = Dr["dispo"].ToString();
result = element.Draw(page, bounds, layoutFormat);
}
SIGN IN To post a reply.
4 Replies
TE
Thiruvenkadam E
Syncfusion Team
August 18, 2009 03:31 PM UTC
Hi pegaso,
Thank you for your interest in Syncfusion products,
Text is overlapping
We can able to avoid the text overlapping by using PdfTextLayoutResult.Remainder property.
Kindly refer the below code snippet which helps to avoid the text overlapping.
[c#]
........
RectangleF bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
foreach (DataRow Dr in Dt.Rows)
{
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Bold11;
element.StringFormat = SF_Titolo;
element.Text = Dr["obb"].ToString();
result = element.Draw(page, bounds, layoutFormat);
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Regular11;
element.StringFormat = SF_Testo;
element.Text = Dr["dispo"].ToString();
result = element.Draw(page, bounds, layoutFormat);
if ((result.Remainder != null) && (result.Remainder.Length > 0))
{
page = doc.Pages.Add();
bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Text = result.Remainder;
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
}
}
Please do find the sample from the below specified location which demonstrates how to avoid the text overlapping and let us know if this helps,
http://files.syncfusion.com/support/PDF.Web/F88925/F88925.zip
Regards,
Thiru
Thank you for your interest in Syncfusion products,
Text is overlapping
We can able to avoid the text overlapping by using PdfTextLayoutResult.Remainder property.
Kindly refer the below code snippet which helps to avoid the text overlapping.
[c#]
........
RectangleF bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
foreach (DataRow Dr in Dt.Rows)
{
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Bold11;
element.StringFormat = SF_Titolo;
element.Text = Dr["obb"].ToString();
result = element.Draw(page, bounds, layoutFormat);
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Regular11;
element.StringFormat = SF_Testo;
element.Text = Dr["dispo"].ToString();
result = element.Draw(page, bounds, layoutFormat);
if ((result.Remainder != null) && (result.Remainder.Length > 0))
{
page = doc.Pages.Add();
bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Text = result.Remainder;
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
}
}
Please do find the sample from the below specified location which demonstrates how to avoid the text overlapping and let us know if this helps,
http://files.syncfusion.com/support/PDF.Web/F88925/F88925.zip
Regards,
Thiru
PE
pegaso
August 24, 2009 08:51 AM UTC
Hi Thiruvenkadam,
sorry but your example don't work fine. The result.Remainder always return null value and the text is overlapping. Can you try the example in attachment?
Thank you.
my_example_b9cef4fb.zip
sorry but your example don't work fine. The result.Remainder always return null value and the text is overlapping. Can you try the example in attachment?
Thank you.
my_example_b9cef4fb.zip
PE
pegaso
August 24, 2009 01:51 PM UTC
...this is the solution:
result = element.Draw(doc.Pages[doc.Pages.Count - 1],...
bye bye
result = element.Draw(doc.Pages[doc.Pages.Count - 1],...
bye bye
TE
Thiruvenkadam E
Syncfusion Team
September 2, 2009 10:40 AM UTC
Hi pegaso,
I am sorry for the inconvenience caused.
Text is overlapping
We can able to avoid the text overlapping by using PdfTextLayoutResult.Remainder property.
Kindly refer the below code snippet which helps to avoid the text overlapping.
Please do find the sample from the below specified location which demonstrates how to avoid the text overlapping and let us know if this helps,
http://files.syncfusion.com/support/PDF.Web/F88925/Sample.zip
Regards,
Thiru
I am sorry for the inconvenience caused.
Text is overlapping
We can able to avoid the text overlapping by using PdfTextLayoutResult.Remainder property.
Kindly refer the below code snippet which helps to avoid the text overlapping.
foreach (DataRow Dr in Dt.Rows)
{
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 20), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Bold11;
element.StringFormat = SF_Titolo;
element.Text = Dr["obb"].ToString();
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
if ((result.Remainder != null) && (result.Remainder.Length > 0))
{
page = doc.Pages.Add();
bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Text = result.Remainder;
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
}
else
{
page = result.Page;
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
}
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Font = Font_Regular11;
element.StringFormat = SF_Testo;
element.Text = Dr["dis"].ToString();
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
if ((result.Remainder != null) && (result.Remainder.Length > 0))
{
page = doc.Pages.Add();
bounds = new RectangleF(new PointF(0, 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
element.Text = result.Remainder;
result = element.Draw(page, bounds.Location, bounds.Width, layoutFormat);
}
else
{
page = result.Page;
bounds = new RectangleF(new PointF(0, result.LastLineBounds.Y + 10), new SizeF(page.Graphics.ClientSize.Width - 20, page.Graphics.ClientSize.Height - 10));
}
}
Please do find the sample from the below specified location which demonstrates how to avoid the text overlapping and let us know if this helps,
http://files.syncfusion.com/support/PDF.Web/F88925/Sample.zip
Regards,
Thiru
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
PE pegaso
- Aug 14, 2009 02:03 PM UTC
- Sep 2, 2009 10:40 AM UTC