Class PdfVerticalAlignment
Specifies the type of Vertical alignment.
Inheritance
System.Object
PdfVerticalAlignment
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.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 |
---|
PdfVerticalAlignment |
Middle
Specifies the element is aligned to Middle.
Declaration
public const PdfVerticalAlignment Middle
Field Value
Type |
---|
PdfVerticalAlignment |
Top
Specifies the element is aligned to Top.
Declaration
public const PdfVerticalAlignment Top
Field Value
Type |
---|
PdfVerticalAlignment |