SkipOnceExample.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 SkipOnceExample
  8. {
  9. [Test]
  10. public void SkipOnce()
  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().Column(column =>
  24. {
  25. column.Item().ShowOnce().Text("This header is visible on the first page.");
  26. column.Item().SkipOnce().Text("This header is visible on the second page and all following.");
  27. });
  28. page.Content()
  29. .PaddingVertical(10)
  30. .Text(Placeholders.Paragraphs())
  31. .FontColor(Colors.Grey.Medium);
  32. page.Footer().Text(text =>
  33. {
  34. text.Span("Page ");
  35. text.CurrentPageNumber();
  36. text.Span(" out of ");
  37. text.TotalPages();
  38. });
  39. });
  40. });
  41. }
  42. }
  43. }