Class PdfLayoutResult
Represents the layouting result format.
Inheritance
System.Object
PdfLayoutResult
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLayoutResult
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF grid instance.
PdfGrid table = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Draw grid to the page of PDF document.
PdfLayoutResult result = table.Draw(page, new PointF(0, 0));
//Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10);
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF grid instance.
Dim table As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Draw grid to the page of PDF document.
Dim result As PdfLayoutResult = table.Draw(page, New PointF(0, 0))
'Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10)
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)
Constructors
PdfLayoutResult(PdfPage, RectangleF)
Represents the layouting result format including bounds and resultant page.
Declaration
public PdfLayoutResult(PdfPage page, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The current page. |
System.Drawing.RectangleF | bounds | The current bounds. |
Remarks
The page might be null, which means that lay outing was performed on PdfGraphics.
Properties
Bounds
Gets the bounds of the element on the last page where it was drawn.
Declaration
public RectangleF Bounds { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF grid instance.
PdfGrid table = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Draw grid to the page of PDF document.
PdfLayoutResult result = table.Draw(page, new PointF(0, 0));
//Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10);
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF grid instance.
Dim table As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Draw grid to the page of PDF document.
Dim result As PdfLayoutResult = table.Draw(page, New PointF(0, 0))
'Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10)
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)
Page
Gets the last page where the element was drawn.
Declaration
public PdfPage Page { get; }
Property Value
Type | Description |
---|---|
PdfPage |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF grid instance.
PdfGrid table = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Draw grid to the page of PDF document.
PdfLayoutResult result = table.Draw(page, new PointF(0, 0));
//Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10);
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF grid instance.
Dim table As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Draw grid to the page of PDF document.
Dim result As PdfLayoutResult = table.Draw(page, New PointF(0, 0))
'Draw grid.
table.Draw(result.Page, result.Bounds.X, result.Bounds.Bottom + 10)
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)