diff --git a/QuestPDF.Examples/ShrinkExamples.cs b/QuestPDF.Examples/ShrinkExamples.cs new file mode 100644 index 0000000..eb4fe29 --- /dev/null +++ b/QuestPDF.Examples/ShrinkExamples.cs @@ -0,0 +1,93 @@ +using NUnit.Framework; +using QuestPDF.Examples.Engine; +using QuestPDF.Fluent; +using QuestPDF.Helpers; + +namespace QuestPDF.Examples +{ + public class ShrinkExamples + { + [Test] + public void Shrink_Without() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Horizontal() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .ShrinkHorizontal() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Vertical() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .ShrinkVertical() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Both() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .Shrink() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Fluent/ShrinkExtensions.cs b/QuestPDF/Fluent/ShrinkExtensions.cs index 53510de..befb9ef 100644 --- a/QuestPDF/Fluent/ShrinkExtensions.cs +++ b/QuestPDF/Fluent/ShrinkExtensions.cs @@ -16,7 +16,7 @@ namespace QuestPDF.Fluent public static IContainer Shrink(this IContainer element) { - return element.ExtendVertical().ExtendHorizontal(); + return element.ShrinkVertical().ShrinkHorizontal(); } public static IContainer ShrinkVertical(this IContainer element)