using ElectronNET.Converter; using System.Text.Json.Serialization; namespace ElectronNET.API.Entities; /// /// /// /// Up-to-date with Electron API 39.2 public class PrintToPDFOptions { /// /// Gets or sets the paper orientation. `true` for landscape, `false` for portrait. Defaults to false. /// public bool Landscape { get; set; } = false; /// /// Gets or sets whether to display header and footer. Defaults to false. /// public bool DisplayHeaderFooter { get; set; } = false; /// /// Gets or sets whether to print background graphics. Defaults to false. /// public bool PrintBackground { get; set; } = false; /// /// Gets or sets the scale of the webpage rendering. Defaults to 1. /// public double Scale { get; set; } = 1; /// /// Gets or sets the page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`, /// `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing /// `height` and `width` in inches. Defaults to `Letter`. /// [JsonConverter(typeof(PageSizeConverter))] public PageSize PageSize { get; set; } = "Letter"; /// /// Gets or sets the paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, /// which means print all pages. /// public string PageRanges { get; set; } = ""; /// /// Gets or sets the HTML template for the print header. Should be valid HTML markup with following /// classes used to inject printing values into them: `date` (formatted print date), /// `title` (document title), `url` (document location), `pageNumber` (current page /// number) and `totalPages` (total pages in the document). For example, `` /// would generate span containing the title. /// public string HeaderTemplate { get; set; } /// /// Gets or sets the HTML template for the print footer. Should use the same format as the /// `headerTemplate`. /// public string FooterTemplate { get; set; } /// /// Gets or sets whether to prefer page size as defined by css. Defaults to false, in /// which case the content will be scaled to fit the paper size. /// public bool PreferCSSPageSize { get; set; } = false; /// /// Gets or sets whether to generate a tagged (accessible) PDF. Defaults to false. /// Experimental per Electron docs; the generated PDF may not adhere fully to PDF/UA and WCAG standards. /// public bool GenerateTaggedPDF { get; set; } = false; /// /// Gets or sets whether to generate a PDF document outline from content headers. Defaults to false. /// Experimental per Electron docs. /// public bool GenerateDocumentOutline { get; set; } = false; public Margins Margins { get; set; } }