| | | 1 | | namespace ZhEaIsNsAaBn.Utilities.PrintPDF; |
| | | 2 | | |
| | | 3 | | /// <summary>Page and PDF options for <see cref="ChromiumHandler"/>.</summary> |
| | | 4 | | public class PrintOptions |
| | | 5 | | { |
| | | 6 | | /// <summary>The viewport width in pixels. Default: 1200.</summary> |
| | | 7 | | public int Width { get; set; } = 1200; |
| | | 8 | | |
| | | 9 | | /// <summary>The viewport height in pixels. Default: 800.</summary> |
| | | 10 | | public int Height { get; set; } = 800; |
| | | 11 | | |
| | | 12 | | /// <summary>Whether the meta viewport tag is taken into account. Default: <see langword="false"/>.</summary> |
| | | 13 | | public bool IsMobile { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary>The device scale factor (device pixel ratio). Default: 1.</summary> |
| | | 16 | | public double DeviceScaleFactor { get; set; } = 1; |
| | | 17 | | |
| | | 18 | | /// <summary>Landscape viewport and landscape paper (same as <see cref="Landscape"/> for the paper). Default: <see l |
| | | 19 | | public bool IsLandscape { get; set; } |
| | | 20 | | |
| | | 21 | | /// <summary>Scale of the page rendering, between 0.1 and 2. Default: 1.</summary> |
| | | 22 | | public decimal Scale { get; set; } = 1; |
| | | 23 | | |
| | | 24 | | /// <summary>Show the header and footer templates. Default: <see langword="false"/>.</summary> |
| | | 25 | | public bool DisplayHeaderFooter { get; set; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// HTML for the print header. Elements with the classes <c>date</c>, <c>title</c>, <c>url</c>, <c>pageNumber</c> an |
| | | 29 | | /// <c>totalPages</c> receive the printing values. |
| | | 30 | | /// </summary> |
| | | 31 | | public string HeaderTemplate { get; set; } = string.Empty; |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// HTML for the print footer (same classes as <see cref="HeaderTemplate"/>), e.g. |
| | | 35 | | /// <c><div style='width:100%; font-size:12px; text-align:right'><span class='pageNumber'></span>/ |
| | | 36 | | /// </summary> |
| | | 37 | | public string FooterTemplate { get; set; } = string.Empty; |
| | | 38 | | |
| | | 39 | | /// <summary>Print background graphics. Default: <see langword="true"/>.</summary> |
| | | 40 | | public bool PrintBackground { get; set; } = true; |
| | | 41 | | |
| | | 42 | | /// <summary>Landscape paper orientation. Default: <see langword="false"/>.</summary> |
| | | 43 | | public bool Landscape { get; set; } |
| | | 44 | | |
| | | 45 | | /// <summary>Pages to print, e.g. <c>1-5, 8, 11-13</c>. Empty (default) prints all pages.</summary> |
| | | 46 | | public string PageRanges { get; set; } = string.Empty; |
| | | 47 | | |
| | | 48 | | /// <summary>Paper format; when set it wins over the content width and height. Default: A4.</summary> |
| | | 49 | | public PaperFormat Format { get; set; } = PaperFormat.A4; |
| | | 50 | | |
| | | 51 | | /// <summary>Paper margins. Default: bottom <c>0.38in</c>, others 0.</summary> |
| | 50 | 52 | | public MarginOptions MarginOptions { get; set; } = new() { Bottom = "0.38in" }; |
| | | 53 | | |
| | | 54 | | /// <summary>Give a CSS <c>@page</c> size priority over the width, height and format. Default: <see langword="false" |
| | | 55 | | public bool PreferCSSPageSize { get; set; } |
| | | 56 | | |
| | | 57 | | /// <summary>Hide the default white background (allows transparency). Default: <see langword="true"/>.</summary> |
| | | 58 | | public bool OmitBackground { get; set; } = true; |
| | | 59 | | } |