Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Profiler.cs 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using AutoMapper;
  2. using PuppeteerSharp;
  3. using BlackRock.Reporting.API.Core.Models;
  4. namespace BlackRock.Reporting.API.Profiles
  5. {
  6. public class Profiler : Profile
  7. {
  8. public Profiler()
  9. {
  10. CreateMap<OptionsForPdf, PdfOptions>().ConvertUsing<OptionsForPdfConverter>();
  11. }
  12. }
  13. public class OptionsForPdfConverter : ITypeConverter<OptionsForPdf, PdfOptions>
  14. {
  15. public PdfOptions Convert(OptionsForPdf source, PdfOptions destination, ResolutionContext context)
  16. {
  17. if(source == null) return destination;
  18. if(destination == null)
  19. destination = new PdfOptions();
  20. destination.DisplayHeaderFooter = source.DisplayHeaderFooter;
  21. destination.HeaderTemplate = source.HeaderTemplate;
  22. destination.Height = source.Height;
  23. destination.Landscape = source.Landscape;
  24. destination.OmitBackground = source.OmitBackground;
  25. destination.PageRanges = source.PageRanges;
  26. destination.PreferCSSPageSize = source.PreferCSSPageSize;
  27. destination.PrintBackground = source.PrintBackground;
  28. destination.Scale = source.Scale;
  29. destination.Width = source.Width;
  30. destination.MarginOptions = new PuppeteerSharp.Media.MarginOptions()
  31. {
  32. Bottom = source.MarginBottom,
  33. Top = source.MarginTop,
  34. Right = source.MarginRight,
  35. Left = source.MarginLeft
  36. };
  37. switch (source.PaperFormatType)
  38. {
  39. case PaperFormatType.A4:
  40. destination.Format = PuppeteerSharp.Media.PaperFormat.A4;
  41. break;
  42. case PaperFormatType.A3:
  43. destination.Format = PuppeteerSharp.Media.PaperFormat.A3;
  44. break;
  45. case PaperFormatType.Letter:
  46. destination.Format = PuppeteerSharp.Media.PaperFormat.Letter;
  47. break;
  48. }
  49. return destination;
  50. }
  51. }
  52. }