diff --git a/QuestPDF.Examples/TextExamples.cs b/QuestPDF.Examples/TextExamples.cs
index c0f7d1d..b01400f 100644
--- a/QuestPDF.Examples/TextExamples.cs
+++ b/QuestPDF.Examples/TextExamples.cs
@@ -11,6 +11,92 @@ namespace QuestPDF.Examples
{
public class TextExamples
{
+ [Test]
+ public void SimpleTextBlock()
+ {
+ RenderingTest
+ .Create()
+ .PageSize(500, 300)
+ .FileName()
+ .ProduceImages()
+ .ShowResults()
+ .Render(container =>
+ {
+ container
+ .Padding(5)
+ .Box()
+ .Border(1)
+ .Padding(10)
+ .Text(text =>
+ {
+ text.DefaultTextStyle(TextStyle.Default.Size(20));
+ text.Span("This is a normal text, followed by an ");
+ text.Span("underlined red text.", TextStyle.Default.Size(20).Color(Colors.Red.Medium).Underline());
+ });
+ });
+ }
+
+ [Test]
+ public void ParagraphSpacing()
+ {
+ RenderingTest
+ .Create()
+ .PageSize(500, 300)
+ .FileName()
+ .ProduceImages()
+ .ShowResults()
+ .Render(container =>
+ {
+ container
+ .Padding(5)
+ .Box()
+ .Border(1)
+ .Padding(10)
+ .Text(text =>
+ {
+ text.ParagraphSpacing(10);
+
+ foreach (var i in Enumerable.Range(1, 3))
+ {
+ text.Span($"Paragraph {i}: ", TextStyle.Default.SemiBold());
+ text.Line(Placeholders.Paragraph());
+ }
+ });
+ });
+ }
+
+ [Test]
+ public void CustomElement()
+ {
+ RenderingTest
+ .Create()
+ .PageSize(500, 200)
+ .FileName()
+ .ProduceImages()
+ .ShowResults()
+ .Render(container =>
+ {
+ container
+ .Padding(5)
+ .Box()
+ .Border(1)
+ .Padding(10)
+ .Text(text =>
+ {
+ text.DefaultTextStyle(TextStyle.Default.Size(20));
+ text.Span("This is a random image aligned to the baseline: ");
+
+ text.Element()
+ .PaddingBottom(-6)
+ .Height(24)
+ .Width(48)
+ .Image(Placeholders.Image);
+
+ text.Span(".");
+ });
+ });
+ }
+
[Test]
public void TextElements()
{
diff --git a/QuestPDF/Fluent/TextExtensions.cs b/QuestPDF/Fluent/TextExtensions.cs
index 16bc59f..dd8eb3c 100644
--- a/QuestPDF/Fluent/TextExtensions.cs
+++ b/QuestPDF/Fluent/TextExtensions.cs
@@ -75,6 +75,11 @@ namespace QuestPDF.Fluent
.ForEach(TextBlocks.Add);
}
+ public void Line(string text, TextStyle? style = null)
+ {
+ Span(text + Environment.NewLine, style);
+ }
+
public void Line(string text)
{
Span(text + Environment.NewLine);
@@ -144,7 +149,7 @@ namespace QuestPDF.Fluent
Element = container
});
- return container.Box();
+ return container.AlignBottom().Box();
}
internal void Compose(IContainer container)
diff --git a/QuestPDF/QuestPDF.csproj b/QuestPDF/QuestPDF.csproj
index 8d55680..fcf853c 100644
--- a/QuestPDF/QuestPDF.csproj
+++ b/QuestPDF/QuestPDF.csproj
@@ -4,7 +4,7 @@
MarcinZiabek
CodeFlint
QuestPDF
- 2021.10.0
+ 2021.10.1
QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API.
Enhanced text rendering capabilities. Improved rendering performance.
8