Xamarin.Android

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

    Show / Hide Table of Contents

    Class PdfVerticalAlignment

    Specifies the type of Vertical alignment.

    Inheritance
    System.Object
    PdfVerticalAlignment
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public sealed class PdfVerticalAlignment : Enum
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Create a new PDF font instance.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
    //Create a new PDF string format instance.
    PdfStringFormat format = new PdfStringFormat();
    //Set the text alignment.
    format.Alignment = PdfTextAlignment.Center;
    //Set the line alignment.
    format.LineAlignment = PdfVerticalAlignment.Middle;
    //Draw string to PDF page.
    graphics.DrawString("Hello World!", font, PdfBrushes.Black, new RectangleF(0, 0, 200, 100), format);
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Create a new PDF font instance.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
    'Create a new PDF string format instance.
    Dim format As PdfStringFormat = New PdfStringFormat()
    'Set the text alignment.
    format.Alignment = PdfTextAlignment.Center
    'Set the line alignment.
    format.LineAlignment = PdfVerticalAlignment.Middle;
    'Draw string to PDF page.
    graphics.DrawString("Hello World!", font, PdfBrushes.Black, New RectangleF(0, 0, 200, 100), format);
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    Fields

    Bottom

    Specifies the element is aligned to Bottom.

    Declaration
    public const PdfVerticalAlignment Bottom
    Field Value
    Type Description
    PdfVerticalAlignment

    Middle

    Specifies the element is aligned to Middle.

    Declaration
    public const PdfVerticalAlignment Middle
    Field Value
    Type Description
    PdfVerticalAlignment

    Top

    Specifies the element is aligned to Top.

    Declaration
    public const PdfVerticalAlignment Top
    Field Value
    Type Description
    PdfVerticalAlignment

    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