File Formats

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Enum PdfVerticalAlignment - FileFormats API Reference | Syncfusion

    Show / Hide Table of Contents

    Enum PdfVerticalAlignment

    Specifies the type of Vertical alignment.

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

    Name Description
    Bottom

    Specifies the element is aligned to Bottom.

    Middle

    Specifies the element is aligned to Middle.

    Top

    Specifies the element is aligned to Top.

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