File Formats

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Enum PdfLayoutBreakType

    Show / Hide Table of Contents

    Enum PdfLayoutBreakType

    Specifies how the element should be contained on the page.

    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public enum 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)

    Fields

    Name Description
    FitColumnsToPage

    Fit the columns withtin the page.

    FitElement

    If the element doesn't fit at the first page, don't draw it on this page.

    FitPage

    Fit the element according to the bounds specified or the page bounds.

    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved