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

OptionsForPdf.cs 3.7KB

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