SkipOnceExample.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using NUnit.Framework;
  2. using QuestPDF.Examples.Engine;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. using QuestPDF.Infrastructure;
  6. namespace QuestPDF.Examples
  7. {
  8. public class SkipOnceExample
  9. {
  10. [Test]
  11. public void SkipOnce()
  12. {
  13. RenderingTest
  14. .Create()
  15. .ProduceImages()
  16. .ShowResults()
  17. .RenderDocument(container =>
  18. {
  19. container.Page(page =>
  20. {
  21. page.Margin(20);
  22. page.Size(PageSizes.A7.Landscape());
  23. page.PageColor(Colors.White);
  24. page.Header().Column(column =>
  25. {
  26. column.Item().ShowOnce().Text("This header is visible on the first page.");
  27. column.Item().SkipOnce().Text("This header is visible on the second page and all following.");
  28. });
  29. page.Content()
  30. .PaddingVertical(10)
  31. .Text(Placeholders.Paragraphs())
  32. .FontColor(Colors.Grey.Medium);
  33. page.Footer().Text(text =>
  34. {
  35. text.Span("Page ");
  36. text.CurrentPageNumber();
  37. text.Span(" out of ");
  38. text.TotalPages();
  39. });
  40. });
  41. });
  42. }
  43. }
  44. }