SkipOnceExample.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.Background(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(), TextStyle.Default.Color(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. }