Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

OptionsForPdf.cs 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System.ComponentModel;
  2. using PuppeteerSharp;
  3. using PuppeteerSharp.Media;
  4. namespace BlackRock.Reporting.API.Core.Models
  5. {
  6. public class BaseEntity
  7. {
  8. public Guid Id { get; set; }
  9. }
  10. public enum PaperFormatType
  11. {
  12. A4 = 0,
  13. A3 = 1,
  14. Letter = 2
  15. }
  16. public class OptionsForPdf
  17. {
  18. public string user { get; set; }
  19. public bool IsLogged { get; set; }
  20. /// <summary>
  21. /// Scale of the webpage rendering. Defaults to <c>1</c>. Scale amount must be between 0.1 and 2.
  22. /// </summary>
  23. public decimal Scale { get; set; } = 1;
  24. /// <summary>
  25. /// Display header and footer. Defaults to <c>false</c>
  26. /// </summary>
  27. public bool DisplayHeaderFooter { get; set; }
  28. /// <summary>
  29. /// HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
  30. /// <c>date</c> - formatted print date
  31. /// <c>title</c> - document title
  32. /// <c>url</c> - document location
  33. /// <c>pageNumber</c> - current page number
  34. /// <c>totalPages</c> - total pages in the document
  35. /// </summary>
  36. public string HeaderTemplate { get; set; } = string.Empty;
  37. /// <summary>
  38. /// HTML template for the print footer. Should be valid HTML markup with following classes used to inject printing values into them:
  39. /// <c>date</c> - formatted print date
  40. /// <c>title</c> - document title
  41. /// <c>url</c> - document location
  42. /// <c>pageNumber</c> - current page number
  43. /// <c>totalPages</c> - total pages in the document
  44. /// </summary>
  45. public string FooterTemplate { get; set; } = string.Empty;
  46. /// <summary>
  47. /// Print background graphics. Defaults to <c>false</c>
  48. /// </summary>
  49. public bool PrintBackground { get; set; }
  50. /// <summary>
  51. /// Paper orientation.. Defaults to <c>false</c>
  52. /// </summary>
  53. public bool Landscape { get; set; }
  54. /// <summary>
  55. /// Paper ranges to print, e.g., <c>1-5, 8, 11-13</c>. Defaults to the empty string, which means print all pages
  56. /// </summary>
  57. public string PageRanges { get; set; } = string.Empty;
  58. /// <summary>
  59. /// Paper format. If set, takes priority over <see cref="Width"/> and <see cref="Height"/>
  60. /// </summary>
  61. public PaperFormatType PaperFormatType { get; set; } = PaperFormatType.A4; // Paper format from client side
  62. /// <summary>
  63. /// Paper width, accepts values labeled with units
  64. /// </summary>
  65. public object Width { get; set; }
  66. /// <summary>
  67. /// Paper height, accepts values labeled with units
  68. /// </summary>
  69. public object Height { get; set; }
  70. /// <summary>
  71. /// Paper margins, defaults to none
  72. /// </summary>
  73. //public MarginOptions MarginOptions { get; set; } = new MarginOptions(){Top="3.0 mm",Right = "3.0 mm",Left="3.0 mm",Bottom="12.7 mm"};
  74. public string MarginTop { get; set; } = "6.0 mm";
  75. public string MarginRight { get; set; } = "3.0 mm";
  76. public string MarginLeft { get; set; } = "3.0 mm";
  77. public string MarginBottom { get; set; } = "12.7 mm";
  78. /// <summary>
  79. /// Give any CSS <c>@page</c> size declared in the page priority over what is declared in <c>width</c> and <c>height</c> or <c>format</c> options.
  80. /// Defaults to <c>false</c>, which will scale the content to fit the paper size.
  81. /// </summary>
  82. public bool PreferCSSPageSize { get; set; }
  83. /// <summary>
  84. /// Hides default white background and allows generating pdfs with transparency.
  85. /// </summary>
  86. public bool OmitBackground { get; set; }
  87. }
  88. }