DefaultTextStyleExamples.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using QuestPDF.Fluent;
  2. using QuestPDF.Helpers;
  3. using QuestPDF.Infrastructure;
  4. namespace QuestPDF.DocumentationExamples;
  5. public class DefaultTextStyleExamples
  6. {
  7. [Test]
  8. public void Example()
  9. {
  10. Document
  11. .Create(document =>
  12. {
  13. document.Page(page =>
  14. {
  15. page.MinSize(new PageSize(0, 0));
  16. page.MaxSize(new PageSize(1000, 1000));
  17. page.DefaultTextStyle(x => x.FontSize(20));
  18. page.Content()
  19. .Width(400)
  20. .Padding(25)
  21. .DefaultTextStyle(x => x.Bold().Underline())
  22. .Column(column =>
  23. {
  24. column.Spacing(10);
  25. column.Item().Text("Inherited bold and underline");
  26. column.Item().Text("Disabled underline, inherited bold and adjusted font color").Underline(false).FontColor(Colors.Green.Darken2);
  27. column.Item()
  28. .DefaultTextStyle(x => x.DecorationWavy().FontColor(Colors.LightBlue.Darken3))
  29. .Text("Changed underline type and adjusted font color");
  30. });
  31. });
  32. })
  33. .GenerateImages(x => "default-text-style.webp", new ImageGenerationSettings() { ImageFormat = ImageFormat.Webp, ImageCompressionQuality = ImageCompressionQuality.VeryHigh, RasterDpi = 144 });
  34. }
  35. }