Program.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using QuestPDF.Fluent;
  2. using QuestPDF.Helpers;
  3. using QuestPDF.Infrastructure;
  4. using QuestPDF.Previewer;
  5. using QuestPDF.ReportSample;
  6. using QuestPDF.ReportSample.Layouts;
  7. //ImagePlaceholder.Solid = true;
  8. var model = DataSource.GetReport();
  9. var report = new StandardReport(model);
  10. report.ShowInPreviewer();
  11. return;
  12. Document
  13. .Create(container =>
  14. {
  15. container.Page(page =>
  16. {
  17. page.Size(PageSizes.A4);
  18. page.Margin(2, Unit.Centimetre);
  19. page.PageColor(Colors.White);
  20. page.DefaultTextStyle(x => x.FontSize(20));
  21. page.Header()
  22. .Text("Hot Reload!")
  23. .SemiBold().FontSize(36).FontColor(Colors.Blue.Darken2);
  24. page.Content()
  25. .PaddingVertical(1, Unit.Centimetre)
  26. .Column(x =>
  27. {
  28. x.Spacing(20);
  29. x.Item().Table(t =>
  30. {
  31. t.ColumnsDefinition(c =>
  32. {
  33. c.RelativeColumn();
  34. c.RelativeColumn(3);
  35. });
  36. t.Cell().Border(1).Background(Colors.Grey.Lighten3).Padding(5).Text("Visual Studio");
  37. t.Cell().Border(1).Padding(5).Text("Start in debug mode with 'Hot Reload on Save' enabled.");
  38. t.Cell().Border(1).Background(Colors.Grey.Lighten3).Padding(5).Text("Command line");
  39. t.Cell().Border(1).Padding(5).Text("Run 'dotnet watch'.");
  40. });
  41. x.Item().Text("Modify this line and the preview should show your changes instantly.");
  42. });
  43. page.Footer()
  44. .AlignCenter()
  45. .Text(x =>
  46. {
  47. x.Span("Page ");
  48. x.CurrentPageNumber();
  49. });
  50. });
  51. })
  52. .ShowInPreviewer();