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

OptionsForPdf.cs 3.6KB

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