GM
Geetha M
Syncfusion Team
October 20, 2010 08:53 AM UTC
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.zipRegards,
Geetha
AM
Antonis Mylonas
October 20, 2010 10:55 AM UTC
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");
}
GM
Geetha M
Syncfusion Team
October 21, 2010 05:09 AM UTC
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