Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfLayoutType

    Show / Hide Table of Contents

    Class PdfLayoutType

    Specifies type of paginating.

    Inheritance
    System.Object
    PdfLayoutType
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public sealed class PdfLayoutType : Enum
    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

    OnePage

    Draw the element on the one page only.

    Declaration
    public const PdfLayoutType OnePage
    Field Value
    Type Description
    PdfLayoutType

    Paginate

    If the element exceeds the page, proceed it on the next page.

    Declaration
    public const PdfLayoutType Paginate
    Field Value
    Type Description
    PdfLayoutType

    value__

    Declaration
    public int value__
    Field Value
    Type Description
    System.Int32
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved