RightToLeftExamples.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using NUnit.Framework;
  2. using QuestPDF.Examples.Engine;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. namespace QuestPDF.Examples
  6. {
  7. public class RightToLeftExamples
  8. {
  9. [Test]
  10. public void Unconstrained()
  11. {
  12. RenderingTest
  13. .Create()
  14. .ProduceImages()
  15. .PageSize(600, 600)
  16. .ShowResults()
  17. .Render(container =>
  18. {
  19. container
  20. .AlignCenter()
  21. .AlignMiddle()
  22. .ContentFromRightToLeft()
  23. .Unconstrained()
  24. .Background(Colors.Red.Medium)
  25. .Height(200)
  26. .Width(200);
  27. });
  28. }
  29. [Test]
  30. public void Row()
  31. {
  32. RenderingTest
  33. .Create()
  34. .ProduceImages()
  35. .PageSize(600, 600)
  36. .ShowResults()
  37. .Render(container =>
  38. {
  39. container
  40. .Padding(25)
  41. .ContentFromRightToLeft()
  42. .Border(1)
  43. .Row(row =>
  44. {
  45. row.ConstantItem(200).Background(Colors.Red.Lighten2).Height(200);
  46. row.ConstantItem(150).Background(Colors.Green.Lighten2).Height(200);
  47. row.ConstantItem(100).Background(Colors.Blue.Lighten2).Height(200);
  48. });
  49. });
  50. }
  51. [Test]
  52. public void MinimalBox()
  53. {
  54. RenderingTest
  55. .Create()
  56. .ProduceImages()
  57. .PageSize(600, 600)
  58. .ShowResults()
  59. .Render(container =>
  60. {
  61. container
  62. .Padding(25)
  63. .ContentFromRightToLeft()
  64. .Border(1)
  65. .MinimalBox()
  66. .Column(column =>
  67. {
  68. column.Item().Background(Colors.Red.Lighten2).Width(200).Height(200);
  69. column.Item().Background(Colors.Green.Lighten2).Width(150).Height(150);
  70. column.Item().Background(Colors.Blue.Lighten2).Width(100).Height(100);
  71. });
  72. });
  73. }
  74. [Test]
  75. public void Table()
  76. {
  77. RenderingTest
  78. .Create()
  79. .ProduceImages()
  80. .PageSize(600, 600)
  81. .ShowResults()
  82. .Render(container =>
  83. {
  84. container
  85. .Padding(25)
  86. .ContentFromRightToLeft()
  87. .Border(1)
  88. .Table(table =>
  89. {
  90. table.ColumnsDefinition(columns =>
  91. {
  92. columns.ConstantColumn(200);
  93. columns.ConstantColumn(150);
  94. columns.ConstantColumn(100);
  95. });
  96. table.Cell().Background(Colors.Red.Lighten2).Height(200);
  97. table.Cell().Background(Colors.Green.Lighten2).Height(200);
  98. table.Cell().Background(Colors.Blue.Lighten2).Height(200);
  99. });
  100. });
  101. }
  102. }
  103. }