We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PdfList objects (Ordered/Unordered) return wrong Bounds result

Thread ID:

Created:

Updated:

Platform:

Replies:

96998 Oct 19,2010 12:07 PM Oct 21,2010 01:09 AM ASP.NET Web Forms (Classic) 3
loading
Tags: PDF
Antonis Mylonas
Asked On October 19, 2010 12:07 PM

Hi,
It seems that the PdfLayoutResult.Bounds.Height returned from PdfList objects is wrong.
The value returned for the Height property also includes the value of property Y.
Is this how it suppose to work?



Geetha M [Syncfusion]
Replied On October 20, 2010 04:53 AM

Hi Antonis,

Thank you for your interest in Syncfusion products.

I am afraid that I am not able to reproduce the problem. The PdfLayoutResult.Bounds property correctly returns the bounds within which it was drawn. I have placed the test sample in the link below. Could you please modify it and send back to me?

F96998.zip

Regards,
Geetha


Antonis Mylonas
Replied On October 20, 2010 06:55 AM

Dear Geetha,
I would like to thank you for your prompt response.

Please replace the following code in the example you have sent me.

private void button1_Click(object sender, EventArgs e) {
//create a Pdf document
PdfDocument doc = new PdfDocument();

//add a new page
PdfPage page = doc.Pages.Add();

//initialize the grid
PdfGrid grid1 = new PdfGrid();

DataTable dt = new DataTable();

DataColumn dc_1 = dt.Columns.Add("Column1");
DataColumn dc_2 = dt.Columns.Add("Column2");
DataColumn dc_3 = dt.Columns.Add("Column3");
DataColumn dc_4 = dt.Columns.Add("Column4");
DataColumn dc_5 = dt.Columns.Add("Column5");

for (int i = 0; i < 5; i++) {
DataRow dr = dt.Rows.Add();
dr["Column1"] = i;
dr["Column2"] = i;
dr["Column3"] = i;
dr["Column4"] = i;
dr["Column5"] = i;
}

grid1.DataSource = dt;

PdfLayoutFormat format = new PdfGridLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;

PdfLayoutResult result = grid1.Draw(page, PointF.Empty, (PdfGridLayoutFormat)format);

//drawing the grid based on the position of the previous grid
result = grid1.Draw(page, new PointF(0, result.Bounds.Bottom + 20), format);

// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
PdfOrderedList ol = new PdfOrderedList();
ol.Items.Add("Item 1");
ol.Items.Add("Item 2");
ol.Items.Add("Item 3");
ol.Items.Add("Item 4");
ol.Items.Add("Item 5");
ol.Items.Add("Item 6");

result = ol.Draw(page, new PointF(result.Bounds.X, result.Bounds.Y + result.Bounds.Height), format);
page.Graphics.DrawRectangle(PdfPens.Yellow, result.Bounds.X, result.Bounds.Y, result.Bounds.Width, result.Bounds.Height - result.Bounds.Y); // By subtracting the result.Bounds.Y, the height is correct
page.Graphics.DrawRectangle(PdfPens.Red, result.Bounds.X, result.Bounds.Y, result.Bounds.Width, result.Bounds.Height);

result = ol.Draw(page, new PointF(result.Bounds.X, result.Bounds.Y + result.Bounds.Height), format);
page.Graphics.DrawRectangle(PdfPens.Yellow, result.Bounds.X, result.Bounds.Y, result.Bounds.Width, result.Bounds.Height - result.Bounds.Y); // By subtracting the result.Bounds.Y, the height is correct
page.Graphics.DrawRectangle(PdfPens.Green, result.Bounds.X, result.Bounds.Y, result.Bounds.Width, result.Bounds.Height);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

doc.Save("Sample.pdf");

System.Diagnostics.Process.Start("Sample.pdf");
}




Geetha M [Syncfusion]
Replied On October 21, 2010 01:09 AM

Hi Antonis,

Thank you for the details.

I was able to reproduce the problem and forwarded it to our development team. Could you please create a new incident in Direct-Trac so that we can send you further details on it?

Regards,
Geetha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;