2021-06-09 23:34:25 +02:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
using QuestPDF.Examples.Engine;
|
2021-01-16 01:31:39 +01:00
|
|
|
using QuestPDF.Fluent;
|
|
|
|
|
using QuestPDF.Infrastructure;
|
|
|
|
|
|
|
|
|
|
namespace QuestPDF.Examples
|
|
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
public class Examples
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
[Test]
|
|
|
|
|
public void Padding()
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
RenderingTest
|
|
|
|
|
.Create()
|
2021-09-30 22:48:39 +02:00
|
|
|
.PageSize(300, 300)
|
|
|
|
|
.ShowResults()
|
2021-06-09 23:34:25 +02:00
|
|
|
.Render(container =>
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
container
|
|
|
|
|
.Background("#FDD")
|
|
|
|
|
.Padding(50)
|
|
|
|
|
|
|
|
|
|
.Background("#AFA")
|
|
|
|
|
.PaddingVertical(50)
|
|
|
|
|
|
|
|
|
|
.Background("#77F")
|
|
|
|
|
.PaddingHorizontal(50)
|
2021-01-16 01:31:39 +01:00
|
|
|
|
|
|
|
|
.Background("#444");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-09 23:34:25 +02:00
|
|
|
[Test]
|
|
|
|
|
public void Border()
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
RenderingTest
|
|
|
|
|
.Create()
|
|
|
|
|
.PageSize(200, 150)
|
|
|
|
|
.Render(container =>
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
container
|
|
|
|
|
.Background("#EEE")
|
|
|
|
|
.Padding(25)
|
|
|
|
|
|
|
|
|
|
.AlignBottom()
|
|
|
|
|
.AlignCenter()
|
|
|
|
|
.BorderBottom(2)
|
|
|
|
|
.BorderColor("#000")
|
|
|
|
|
|
|
|
|
|
.Background("FFF")
|
|
|
|
|
.Padding(5)
|
2021-08-25 03:40:16 +02:00
|
|
|
.AlignCenter()
|
2022-03-08 17:27:30 +01:00
|
|
|
.Text("Sample text")
|
2022-03-11 13:23:36 +01:00
|
|
|
.FontFamily("Segoe UI emoji");
|
2021-06-09 23:34:25 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Alignment()
|
|
|
|
|
{
|
|
|
|
|
RenderingTest
|
|
|
|
|
.Create()
|
|
|
|
|
.PageSize(200, 150)
|
|
|
|
|
.Render(container =>
|
|
|
|
|
{
|
|
|
|
|
container
|
2022-01-09 00:11:34 +01:00
|
|
|
.Column(column =>
|
2021-01-16 01:31:39 +01:00
|
|
|
{
|
2021-06-09 23:34:25 +02:00
|
|
|
column
|
|
|
|
|
.Item()
|
|
|
|
|
.Height(100)
|
|
|
|
|
.Background("#FFF")
|
|
|
|
|
|
|
|
|
|
.AlignLeft()
|
|
|
|
|
.AlignMiddle()
|
2021-01-16 01:31:39 +01:00
|
|
|
|
|
|
|
|
.Width(50)
|
|
|
|
|
.Height(50)
|
2021-06-09 23:34:25 +02:00
|
|
|
.Background("#444");
|
2021-01-16 01:31:39 +01:00
|
|
|
|
2021-06-09 23:34:25 +02:00
|
|
|
column
|
|
|
|
|
.Item()
|
|
|
|
|
.Height(100)
|
|
|
|
|
.Background("#DDD")
|
|
|
|
|
|
|
|
|
|
.AlignCenter()
|
|
|
|
|
.AlignMiddle()
|
2021-01-16 01:31:39 +01:00
|
|
|
|
|
|
|
|
.Width(50)
|
2021-06-09 23:34:25 +02:00
|
|
|
.Height(50)
|
|
|
|
|
.Background("#222");
|
|
|
|
|
|
|
|
|
|
column
|
|
|
|
|
.Item()
|
|
|
|
|
.Height(100)
|
|
|
|
|
.Background("#BBB")
|
|
|
|
|
|
|
|
|
|
.AlignRight()
|
|
|
|
|
.AlignMiddle()
|
2021-01-16 01:31:39 +01:00
|
|
|
|
2021-06-09 23:34:25 +02:00
|
|
|
.Width(50)
|
|
|
|
|
.Height(50)
|
|
|
|
|
.Background("#000");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Expand()
|
|
|
|
|
{
|
|
|
|
|
RenderingTest
|
|
|
|
|
.Create()
|
|
|
|
|
.PageSize(200, 150)
|
|
|
|
|
.Render(container =>
|
|
|
|
|
{
|
|
|
|
|
container
|
2022-01-09 00:11:34 +01:00
|
|
|
.Column(column =>
|
2021-06-09 23:34:25 +02:00
|
|
|
{
|
|
|
|
|
column
|
|
|
|
|
.Item()
|
|
|
|
|
.Height(150)
|
|
|
|
|
.Row(row =>
|
|
|
|
|
{
|
2022-01-09 00:11:34 +01:00
|
|
|
row.RelativeItem()
|
2021-06-09 23:34:25 +02:00
|
|
|
.Extend()
|
|
|
|
|
.Background("FFF")
|
|
|
|
|
|
|
|
|
|
.Height(50)
|
|
|
|
|
.Width(50)
|
|
|
|
|
.Background("444");
|
|
|
|
|
|
2022-01-09 00:11:34 +01:00
|
|
|
row.RelativeItem()
|
2021-06-09 23:34:25 +02:00
|
|
|
.Extend()
|
|
|
|
|
.Background("BBB")
|
|
|
|
|
|
|
|
|
|
.Height(50)
|
|
|
|
|
.ExtendHorizontal()
|
|
|
|
|
.Background("444");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
column
|
|
|
|
|
.Item()
|
|
|
|
|
.Height(150)
|
|
|
|
|
.Row(row =>
|
|
|
|
|
{
|
2022-01-09 00:11:34 +01:00
|
|
|
row.RelativeItem()
|
2021-06-09 23:34:25 +02:00
|
|
|
.Extend()
|
|
|
|
|
.Background("BBB")
|
|
|
|
|
|
|
|
|
|
.ExtendVertical()
|
|
|
|
|
.Width(50)
|
|
|
|
|
.Background("444");
|
|
|
|
|
|
2022-01-09 00:11:34 +01:00
|
|
|
row.RelativeItem()
|
2021-06-09 23:34:25 +02:00
|
|
|
.Extend()
|
|
|
|
|
.Background("BBB")
|
|
|
|
|
|
|
|
|
|
.ExtendVertical()
|
|
|
|
|
.ExtendHorizontal()
|
|
|
|
|
.Background("444");
|
|
|
|
|
});
|
2021-01-16 01:31:39 +01:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|