Xamarin.Android

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

    Show / Hide Table of Contents

    Class PdfLine

    Represents a line shape.

    Inheritance
    System.Object
    PdfGraphicsElement
    PdfLayoutElement
    PdfShapeElement
    PdfDrawElement
    PdfLine
    Inherited Members
    PdfDrawElement.Pen
    PdfShapeElement.GetBounds()
    PdfShapeElement.Layout(PdfLayoutParams)
    PdfLayoutElement.add_EndPageLayout(EndPageLayoutEventHandler)
    PdfLayoutElement.remove_EndPageLayout(EndPageLayoutEventHandler)
    PdfLayoutElement.add_BeginPageLayout(BeginPageLayoutEventHandler)
    PdfLayoutElement.remove_BeginPageLayout(BeginPageLayoutEventHandler)
    PdfLayoutElement.Draw(PdfPage, PointF)
    PdfLayoutElement.Draw(PdfPage, Single, Single)
    PdfLayoutElement.Draw(PdfPage, RectangleF)
    PdfLayoutElement.Draw(PdfPage, PointF, PdfLayoutFormat)
    PdfLayoutElement.Draw(PdfPage, Single, Single, PdfLayoutFormat)
    PdfLayoutElement.Draw(PdfPage, RectangleF, PdfLayoutFormat)
    PdfLayoutElement.Layout(HtmlToPdfLayoutParams)
    PdfLayoutElement.PdfTag
    PdfLayoutElement.EndPageLayout
    PdfLayoutElement.BeginPageLayout
    PdfGraphicsElement.Draw(PdfGraphics)
    PdfGraphicsElement.Draw(PdfGraphics, PointF)
    PdfGraphicsElement.Draw(PdfGraphics, Single, Single)
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfLine : PdfDrawElement
    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    Constructors

    PdfLine(PointF, PointF)

    Initializes a new instance of the PdfLine class.

    Declaration
    public PdfLine(PointF point1, PointF point2)
    Parameters
    Type Name Description
    PointF point1

    The line start point.

    PointF point2

    The line end point.

    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    PdfLine(PdfPen, PointF, PointF)

    Initializes a new instance of the PdfLine class.

    Declaration
    public PdfLine(PdfPen pen, PointF point1, PointF point2)
    Parameters
    Type Name Description
    PdfPen pen

    The pen.

    PointF point1

    The line start point.

    PointF point2

    The line end point.

    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PDF pen.
     PdfPen pen = new PdfPen(Color.Red);
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(pen, new PointF(0, 0), new PointF(100, 0));
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PDF pen.
    Dim pen As New PdfPen(Color.Red)
    'Create new PdfLine instance.
    Dim line As New PdfLine(pen, New PointF(0, 0), New PointF(100, 0))
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    PdfLine(PdfPen, Single, Single, Single, Single)

    Initializes a new instance of the PdfLine class.

    Declaration
    public PdfLine(PdfPen pen, float x1, float y1, float x2, float y2)
    Parameters
    Type Name Description
    PdfPen pen

    The pen.

    System.Single x1

    The x-coordinate of the first point.

    System.Single y1

    The y-coordinate of the first point.

    System.Single x2

    The x-coordinate of the end pint.

    System.Single y2

    The y-coordinate of the end pint.

    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PDF pen.
     PdfPen pen = new PdfPen(Color.Red);
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(pen, 0, 0, 100, 0);
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PDF pen.
    Dim pen As New PdfPen(Color.Red)
    'Create new PdfLine instance.
    Dim line As New PdfLine(pen, 0, 0, 100, 0)
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    PdfLine(Single, Single, Single, Single)

    Initializes a new instance of the PdfLine class from the specified two pair fo coordinates.

    Declaration
    public PdfLine(float x1, float y1, float x2, float y2)
    Parameters
    Type Name Description
    System.Single x1

    The x-coordinate of the first point.

    System.Single y1

    The y-coordinate of the first point.

    System.Single x2

    The x-coordinate of the end pint.

    System.Single y2

    The y-coordinate of the end pint.

    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(0, 0, 100, 0);
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(0, 0, 100, 0)
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    Properties

    X1

    Gets or sets the x coordinate of the start point.

    Declaration
    public float X1 { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Set the x coordinate of the start point.
     line.X1 = 0;
     //Set the y coordinate of the start point.
     line.Y1 = 0;
     //Set the x coordinate of the end point.
     line.X2 = 100;
     //Set the y coordinate of the end point.
     line.Y2 = 0;
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Set the x coordinate of the start point.
    line.X1 = 0
    'Set the y coordinate of the start point.
    line.Y1 = 0
    'Set the x coordinate of the end point.
    line.X2 = 100
    'Set the y coordinate of the end point.
    line.Y2 = 0
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    X2

    Gets or sets the x coordinate of the end point.

    Declaration
    public float X2 { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Set the x coordinate of the start point.
     line.X1 = 0;
     //Set the y coordinate of the start point.
     line.Y1 = 0;
     //Set the x coordinate of the end point.
     line.X2 = 100;
     //Set the y coordinate of the end point.
     line.Y2 = 0;
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Set the x coordinate of the start point.
    line.X1 = 0
    'Set the y coordinate of the start point.
    line.Y1 = 0
    'Set the x coordinate of the end point.
    line.X2 = 100
    'Set the y coordinate of the end point.
    line.Y2 = 0
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    Y1

    Gets or sets the y coordinate of the start point.

    Declaration
    public float Y1 { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Set the x coordinate of the start point.
     line.X1 = 0;
     //Set the y coordinate of the start point.
     line.Y1 = 0;
     //Set the x coordinate of the end point.
     line.X2 = 100;
     //Set the y coordinate of the end point.
     line.Y2 = 0;
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Set the x coordinate of the start point.
    line.X1 = 0
    'Set the y coordinate of the start point.
    line.Y1 = 0
    'Set the x coordinate of the end point.
    line.X2 = 100
    'Set the y coordinate of the end point.
    line.Y2 = 0
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)

    Y2

    Gets or sets the y coordinate of the end point.

    Declaration
    public float Y2 { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
     //Create a new PDF document.
     PdfDocument document = new PdfDocument();
     //Add a new PDF page.
     PdfPage page = document.Pages.Add();
     //Create new PdfLine instance.
     PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
     //Set the x coordinate of the start point.
     line.X1 = 0;
     //Set the y coordinate of the start point.
     line.Y1 = 0;
     //Set the x coordinate of the end point.
     line.X2 = 100;
     //Set the y coordinate of the end point.
     line.Y2 = 0;
     //Draw the line to PDF page.
     line.Draw(page, PointF.Empty);
     //Save the PDF docment.
     document.Save("output.pdf");
     //Close the PDF document.
     document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create new PdfLine instance.
    Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
    'Set the x coordinate of the start point.
    line.X1 = 0
    'Set the y coordinate of the start point.
    line.Y1 = 0
    'Set the x coordinate of the end point.
    line.X2 = 100
    'Set the y coordinate of the end point.
    line.Y2 = 0
    'Draw the line to PDF page.
    line.Draw(page, PointF.Empty)
    'Save the PDF docment.
    document.Save("output.pdf")
    'Close the PDF document.
    document.Close(True)
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved