DefaultTextStyle API improvements

This commit is contained in:
MarcinZiabek
2022-03-12 16:11:03 +01:00
parent 2c14f91ebe
commit 1b9b164583
3 changed files with 16 additions and 11 deletions
+2 -10
View File
@@ -11,7 +11,7 @@ namespace QuestPDF.Examples
public class PageBackgroundForeground
{
[Test]
public void Frame()
public void Test()
{
RenderingTest
.Create()
@@ -31,7 +31,7 @@ namespace QuestPDF.Examples
.AlignCenter()
.Text("Watermark")
.FontSize(64)
.FontColor(Colors.Blue.Lighten4);
.FontColor(Colors.Blue.Lighten3);
page.Header().Text("Background and foreground").Bold().FontColor(Colors.Blue.Medium).FontSize(24);
@@ -42,14 +42,6 @@ namespace QuestPDF.Examples
foreach (var i in Enumerable.Range(0, 100))
column.Item().Background(Colors.Grey.Lighten2).Height(75);
});
page.Footer()
.AlignCenter()
.Text(x =>
{
x.Span("Page ");
x.CurrentPageNumber();
});
});
});
}
+9 -1
View File
@@ -177,7 +177,15 @@ namespace QuestPDF.Fluent
TextStyle = textStyle
});
}
public static IContainer DefaultTextStyle(this IContainer element, Func<TextStyle, TextStyle> handler)
{
return element.Element(new DefaultTextStyle
{
TextStyle = handler(TextStyle.Default)
});
}
public static IContainer StopPaging(this IContainer element)
{
return element.Element(new StopPaging());
+5
View File
@@ -83,6 +83,11 @@ namespace QuestPDF.Fluent
Page.DefaultTextStyle = textStyle;
}
public void DefaultTextStyle(Func<TextStyle, TextStyle> handler)
{
DefaultTextStyle(handler(TextStyle.Default));
}
public void Background(string color)
{
Page.BackgroundColor = color;