InlinedExamples.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Linq;
  3. using NUnit.Framework;
  4. using QuestPDF.Examples.Engine;
  5. using QuestPDF.Fluent;
  6. using QuestPDF.Helpers;
  7. namespace QuestPDF.Examples
  8. {
  9. public class InlinedExamples
  10. {
  11. [Test]
  12. public void Inlined()
  13. {
  14. RenderingTest
  15. .Create()
  16. .PageSize(800, 575)
  17. .FileName()
  18. .ProduceImages()
  19. .ShowResults()
  20. .Render(container =>
  21. {
  22. container
  23. .Padding(25)
  24. .Border(1)
  25. .Background(Colors.Grey.Lighten2)
  26. .Inlined(inlined =>
  27. {
  28. inlined.Spacing(25);
  29. inlined.AlignCenter();
  30. inlined.BaselineMiddle();
  31. var random = new Random();
  32. foreach (var _ in Enumerable.Range(0, 50))
  33. {
  34. inlined
  35. .Item()
  36. .Border(1)
  37. .Width(random.Next(1, 5) * 25)
  38. .Height(random.Next(1, 5) * 25)
  39. .Background(Placeholders.BackgroundColor());
  40. }
  41. });
  42. });
  43. }
  44. }
  45. }