ExecutionOrderExamples.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using NUnit.Framework;
  2. using QuestPDF.Drawing.Exceptions;
  3. using QuestPDF.Examples.Engine;
  4. using QuestPDF.Fluent;
  5. using QuestPDF.Helpers;
  6. using QuestPDF.Infrastructure;
  7. namespace QuestPDF.Examples
  8. {
  9. public class ExecutionOrderExamples
  10. {
  11. [Test]
  12. public void Example()
  13. {
  14. RenderingTest
  15. .Create()
  16. .PageSize(400, 300)
  17. .ProduceImages()
  18. .ShowResults()
  19. .Render(container =>
  20. {
  21. container
  22. .DefaultTextStyle(TextStyle.Default.Size(18))
  23. .Padding(25)
  24. .Row(row =>
  25. {
  26. row.Spacing(25);
  27. row.RelativeItem()
  28. .Border(1)
  29. .Padding(15)
  30. .Background(Colors.Grey.Lighten2)
  31. .Text("Lorem ipsum");
  32. row.RelativeItem()
  33. .Border(1)
  34. .Background(Colors.Grey.Lighten2)
  35. .Padding(15)
  36. .Text("dolor sit amet");
  37. });
  38. });
  39. }
  40. [Test]
  41. public void Example2()
  42. {
  43. RenderingTest
  44. .Create()
  45. .PageSize(200, 200)
  46. .ProduceImages()
  47. .ShowResults()
  48. .Render(container =>
  49. {
  50. container
  51. .Padding(25)
  52. .Border(2)
  53. .Width(150)
  54. .Height(150)
  55. .Background(Colors.Blue.Lighten2)
  56. .PaddingTop(50)
  57. .Background(Colors.Green.Lighten2)
  58. .PaddingRight(50)
  59. .Background(Colors.Red.Lighten2)
  60. .PaddingBottom(50)
  61. .Background(Colors.Amber.Lighten2)
  62. .PaddingLeft(50)
  63. .Background(Colors.Grey.Lighten2);
  64. });
  65. }
  66. }
  67. }