menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfLayoutFormat - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfLayoutFormat

    Represents a layouting format

    Inheritance
    System.Object
    PdfLayoutFormat
    PdfMetafileLayoutFormat
    PdfGridLayoutFormat
    PdfLightTableLayoutFormat
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfLayoutFormat
    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), format);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), format)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)

    Constructors

    PdfLayoutFormat()

    Initializes a new instance of the PdfLayoutFormat class.

    Declaration
    public PdfLayoutFormat()
    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), format);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), format)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)

    PdfLayoutFormat(PdfLayoutFormat)

    Initializes a new instance of the PdfLayoutFormat class from the specified layout format

    Declaration
    public PdfLayoutFormat(PdfLayoutFormat baseFormat)
    Parameters
    Type Name Description
    PdfLayoutFormat baseFormat

    The base format.

    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Create new PDF layout format instance.
    PdfLayoutFormat newFormat = new PdfLayoutFormat(format);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), newFormat);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Create new PDF layout format instance.
    Dim newFormat As PdfLayoutFormat = New PdfLayoutFormat(format)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), newFormat)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)

    Properties

    Break

    Gets or sets break type of the element.

    Declaration
    public PdfLayoutBreakType Break { get; set; }
    Property Value
    Type
    PdfLayoutBreakType
    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), format);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), format)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)

    Layout

    Gets or sets layout type of the element.

    Declaration
    public PdfLayoutType Layout { get; set; }
    Property Value
    Type
    PdfLayoutType
    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), format);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), format)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)

    PaginateBounds

    Gets or sets the bounds on the next page.

    Declaration
    public RectangleF PaginateBounds { get; set; }
    Property Value
    Type
    System.Drawing.RectangleF
    Remarks

    If this property is set, the element will use it for the layouting on the next pages, otherwise, the element will be layout according to the bounds, used on the first page.

    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.
    for (int i = 20; i>0; i--) 
    {
    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;
    //Create new PDF layout format instance.
    PdfLayoutFormat format = new PdfLayoutFormat();
    //Set page break.
    format.Break = PdfLayoutBreakType.FitPage;
    //Set layout type.
    format.Layout = PdfLayoutType.Paginate;
    //Set paginate bounds.
    format.PaginateBounds = new RectangleF(0, 0, 500, 350);
    //Draw grid to the page of PDF document.
    table.Draw(page, new RectangleF(0,0, 500, 700), format);
    //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.
    For i As Integer = 20 To 1 Step -1
    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"})
    Next
    'Assign data source.
    table.DataSource = dataTable
    'Create new PDF layout format instance.
    Dim format As New PdfLayoutFormat()
    'Set page break.
    format.Break = PdfLayoutBreakType.FitPage
    'Set layout type.
    format.Layout = PdfLayoutType.Paginate
    'Set paginate bounds.
    format.PaginateBounds = New RectangleF(0, 0, 500, 350)
    'Draw grid to the page of PDF document.
    table.Draw(page, New RectangleF(0, 0, 500, 700), format)
    'Save the document.
    doc.Save("Output.pdf")
    'close the document
    doc.Close(True)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved