Skip to content
If you like QuestPDF, please give it a star on GitHub.
It takes seconds and helps others make the right choice!

Alignment

The Alignment element controls the positioning of its child content within the available space. It offers both horizontal and vertical options that can be used independently or combined.

API

Horizontal

MethodDescription
AlignLeftAligns content horizontally to the left side.
AlignCenterAligns content horizontally to the center, ensuring equal space on both left and right sides.
AlignRightAligns its content horizontally to the right side.

Vertical

MethodDescription
AlignTopAligns content vertically to the upper side.
AlignMiddleAligns content vertically to the center, ensuring equal space above and below.
AlignBottomAligns content vertically to the bottom side.

Example

c#
container
    .Width(300)
    .Height(300)
    .AlignBottom()
    .AlignCenter()
    .Background(Colors.Grey.Lighten2)
    .Padding(10)
    .Text("Test");

example

Released under the MIT License