| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Linq;
- using NUnit.Framework;
- using QuestPDF.Examples.Engine;
- using QuestPDF.Fluent;
- using QuestPDF.Helpers;
- using QuestPDF.Infrastructure;
- namespace QuestPDF.Examples
- {
- public class ColumnExamples
- {
- [Test]
- public void Column()
- {
- RenderingTest
- .Create()
- .PageSize(PageSizes.A4)
- .ShowResults()
- .ProducePdf()
- .Render(container =>
- {
- container.Column(column =>
- {
- foreach (var i in Enumerable.Range(0, 10))
- column.Item().Element(Block);
- static void Block(IContainer container)
- {
- container
- .Width(72)
- .Height(3.5f, Unit.Inch)
- .Height(1.5f, Unit.Inch)
- .Background(Placeholders.BackgroundColor());
- }
- });
- });
- }
-
- [Test]
- public void Stability_NoItems()
- {
- RenderingTest
- .Create()
- .ProducePdf()
- .MaxPages(100)
- .PageSize(250, 150)
- .Render(container =>
- {
- container
- .Padding(25)
- .Column(column => { });
- });
- }
-
- [Test]
- public void MultiColumn()
- {
- RenderingTest
- .Create()
- .ProducePdf()
- .ShowResults()
- .EnableDebugging()
- .PageSize(PageSizes.A4)
- .MaxPages(100)
- .Render(container =>
- {
- container
- .Padding(20)
- .MultiColumn(content =>
- {
- content.Spacing(20);
- foreach (var i in Enumerable.Range(1, 70))
- {
- content
- .Item()
- .Width(150 + (float)Math.Sin(i * 2 * Math.PI / 10) * 50)
- .Height(40)
- .Border(1)
- .Background(Colors.Grey.Lighten4)
- .AlignCenter()
- .AlignMiddle()
- .Text(i.ToString());
- }
- });
- });
- }
- }
- }
|