| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- using NUnit.Framework;
- using QuestPDF.Examples.Engine;
- using QuestPDF.Fluent;
- using QuestPDF.Helpers;
- using QuestPDF.Infrastructure;
- namespace QuestPDF.Examples
- {
- public class Examples
- {
- [Test]
- public void Padding()
- {
- RenderingTest
- .Create()
- .PageSize(300, 300)
- .ShowResults()
- .Render(container =>
- {
- container
- .Background(Colors.Red.Lighten2)
- .Padding(50)
- .Background(Colors.Green.Lighten2)
- .PaddingVertical(50)
- .Background(Colors.Blue.Lighten2)
- .PaddingHorizontal(50)
- .Background(Colors.Grey.Darken2);
- });
- }
-
- [Test]
- public void Border()
- {
- RenderingTest
- .Create()
- .PageSize(200, 150)
- .Render(container =>
- {
- container
- .Background(Colors.Grey.Lighten3)
- .Padding(25)
- .AlignBottom()
- .AlignCenter()
- .BorderBottom(2)
- .BorderColor(Colors.Black)
-
- .Background(Colors.White)
- .Padding(5)
- .AlignCenter()
- .Text("Sample text")
- .FontFamily("Segoe UI emoji");
- });
- }
-
- [Test]
- public void Alignment()
- {
- RenderingTest
- .Create()
- .PageSize(200, 150)
- .Render(container =>
- {
- container
- .Column(column =>
- {
- column
- .Item()
- .Height(100)
- .Background(Colors.White)
-
- .AlignLeft()
- .AlignMiddle()
- .Width(50)
- .Height(50)
- .Background(Colors.Grey.Darken2);
-
- column
- .Item()
- .Height(100)
- .Background(Colors.Grey.Lighten4)
-
- .AlignCenter()
- .AlignMiddle()
- .Width(50)
- .Height(50)
- .Background(Colors.Grey.Darken3);
-
- column
- .Item()
- .Height(100)
- .Background(Colors.Grey.Lighten3)
-
- .AlignRight()
- .AlignMiddle()
- .Width(50)
- .Height(50)
- .Background(Colors.Black);
- });
- });
- }
-
- [Test]
- public void Expand()
- {
- RenderingTest
- .Create()
- .PageSize(200, 150)
- .Render(container =>
- {
- container
- .Column(column =>
- {
- column
- .Item()
- .Height(150)
- .Row(row =>
- {
- row.RelativeItem()
- .Extend()
- .Background(Colors.White)
- .Height(50)
- .Width(50)
- .Background(Colors.Grey.Darken2);
-
- row.RelativeItem()
- .Extend()
- .Background(Colors.Grey.Lighten3)
- .Height(50)
- .ExtendHorizontal()
- .Background(Colors.Grey.Darken2);
- });
-
- column
- .Item()
- .Height(150)
- .Row(row =>
- {
- row.RelativeItem()
- .Extend()
- .Background(Colors.Grey.Lighten3)
- .ExtendVertical()
- .Width(50)
- .Background(Colors.Grey.Darken2);
-
- row.RelativeItem()
- .Extend()
- .Background(Colors.Grey.Lighten3)
- .ExtendVertical()
- .ExtendHorizontal()
- .Background(Colors.Grey.Darken2);
- });
- });
- });
- }
- }
- }
|