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

OptionsForPdf.cs 3.3KB

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