ColumnExamples.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using QuestPDF.Fluent;
  2. using QuestPDF.Helpers;
  3. using QuestPDF.Infrastructure;
  4. namespace QuestPDF.DocumentationExamples;
  5. public class ColumnExamples
  6. {
  7. [Test]
  8. public void SimpleExample()
  9. {
  10. Document
  11. .Create(document =>
  12. {
  13. document.Page(page =>
  14. {
  15. page.MinSize(new PageSize(0, 0));
  16. page.MaxSize(new PageSize(1000, 1000));
  17. page.DefaultTextStyle(x => x.FontSize(20));
  18. page.Content()
  19. .Width(250)
  20. .Padding(25)
  21. .Column(column =>
  22. {
  23. column.Item().Background(Colors.Grey.Medium).Height(50);
  24. column.Item().Background(Colors.Grey.Lighten1).Height(75);
  25. column.Item().Background(Colors.Grey.Lighten2).Height(100);
  26. });
  27. });
  28. })
  29. .GenerateImages(x => "column-simple.webp", new ImageGenerationSettings() { ImageFormat = ImageFormat.Webp, ImageCompressionQuality = ImageCompressionQuality.VeryHigh, RasterDpi = 144 });
  30. }
  31. [Test]
  32. public void ManyExample()
  33. {
  34. Document
  35. .Create(document =>
  36. {
  37. document.Page(page =>
  38. {
  39. page.MinSize(new PageSize(0, 0));
  40. page.MaxSize(new PageSize(1000, 1000));
  41. page.DefaultTextStyle(x => x.FontSize(20));
  42. page.Content()
  43. .Width(250)
  44. .Padding(25)
  45. .Column(column =>
  46. {
  47. column.Spacing(25);
  48. column.Item().Background(Colors.Grey.Medium).Height(50);
  49. column.Item().Background(Colors.Grey.Lighten1).Height(75);
  50. column.Item().Background(Colors.Grey.Lighten2).Height(100);
  51. });
  52. });
  53. })
  54. .GenerateImages(x => "column-spacing.webp", new ImageGenerationSettings() { ImageFormat = ImageFormat.Webp, ImageCompressionQuality = ImageCompressionQuality.VeryHigh, RasterDpi = 144 });
  55. }
  56. }