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

Offset

This container allows you to precisely position content by moving it horizontally and vertically relative to its original position, independent of layout constraints.

When you apply offset, the element maintains its original size constraints while shifting its visual position.

MethodDescription
OffsetXMoves content along the horizontal axis. A positive value moves content to the right; a negative value moves it to the left. Does not alter the available space.
OffsetYMoves content along the vertical axis. A positive value moves content downwards; a negative value moves it upwards. Does not alter the available space.
csharp
container
    .Padding(50)
    .Background(Colors.Blue.Lighten3)
    .OffsetX(25)
    .OffsetY(25)
    .Border(4)
    .BorderColor(Colors.Blue.Darken2)
    .Padding(50)
    .Text("Moved content")
    .FontSize(25);

example