TextExamples.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. using NUnit.Framework;
  2. using QuestPDF.Examples.Engine;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. using QuestPDF.Infrastructure;
  6. namespace QuestPDF.Examples
  7. {
  8. public class TextExamples
  9. {
  10. [Test]
  11. public void TextElements()
  12. {
  13. RenderingTest
  14. .Create()
  15. .PageSize(600, 400)
  16. .FileName()
  17. .ProducePdf()
  18. .Render(container =>
  19. {
  20. container.Padding(20).Text(text =>
  21. {
  22. text.Span("Let's start with something bold...", TextStyle.Default.SemiBold().Size(18));
  23. text.Span("And BIG...", TextStyle.Default.Size(28).Color(Colors.DeepOrange.Darken2).BackgroundColor(Colors.Yellow.Lighten3).Underlined());
  24. text.Span(Placeholders.LoremIpsum(), TextStyle.Default.Size(16));
  25. //text.Element().ExternalLink("https://www.questpdf.com/").Width(200).Height(50).Text("Visit questpdf.com", TextStyle.Default.Underlined().Color(Colors.Blue.Darken2));
  26. text.Span(Placeholders.LoremIpsum(), TextStyle.Default.Size(16).Stroked());
  27. text.Span("And now it's time for some colors 12345 678 90293 03490 83290.", TextStyle.Default.Size(20).Color(Colors.Green.Medium));
  28. });
  29. });
  30. }
  31. }
  32. }