EnsureSpaceExample.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 EnsureSpaceExample
  8. {
  9. [Test]
  10. public void EnsureSpaceWith()
  11. {
  12. RenderingTest
  13. .Create()
  14. .ProduceImages()
  15. .ShowResults()
  16. .RenderDocument(container =>
  17. {
  18. container.Page(page =>
  19. {
  20. page.Margin(20);
  21. page.Size(PageSizes.A7.Landscape());
  22. page.PageColor(Colors.White);
  23. page.Header().Text("With ensure space").SemiBold();
  24. page.Content().Column(column =>
  25. {
  26. column
  27. .Item()
  28. .ExtendHorizontal()
  29. .Height(75)
  30. .Background(Colors.Grey.Lighten2);
  31. column
  32. .Item()
  33. .EnsureSpace(100)
  34. .Text(Placeholders.LoremIpsum());
  35. });
  36. page.Footer().Text(text =>
  37. {
  38. text.Span("Page ");
  39. text.CurrentPageNumber();
  40. text.Span(" out of ");
  41. text.TotalPages();
  42. });
  43. });
  44. });
  45. }
  46. }
  47. }