using System.Text.Json.Serialization; namespace HtmlToPdfService.Client.Models; /// /// PDF 转换选项 /// public class PdfOptions { /// /// 页面格式,如 A4, Letter, Legal 等 /// [JsonPropertyName("format")] public string? Format { get; set; } /// /// 是否横向 /// [JsonPropertyName("landscape")] public bool? Landscape { get; set; } /// /// 是否打印背景 /// [JsonPropertyName("printBackground")] public bool? PrintBackground { get; set; } /// /// 页边距设置 /// [JsonPropertyName("margin")] public MarginOptions? Margin { get; set; } /// /// 自定义页面宽度,支持单位:px, in, cm, mm(如 "1309px", "210mm") /// 设置后将忽略 Format 参数 /// [JsonPropertyName("width")] public string? Width { get; set; } /// /// 自定义页面高度,支持单位:px, in, cm, mm(如 "926px", "297mm") /// 设置后将忽略 Format 参数 /// [JsonPropertyName("height")] public string? Height { get; set; } /// /// 浏览器视口宽度(像素),控制页面渲染时的窗口宽度 /// [JsonPropertyName("viewportWidth")] public int? ViewportWidth { get; set; } /// /// 浏览器视口高度(像素),控制页面渲染时的窗口高度 /// [JsonPropertyName("viewportHeight")] public int? ViewportHeight { get; set; } } /// /// 页边距选项 /// public class MarginOptions { /// /// 上边距(如 "10mm") /// [JsonPropertyName("top")] public string? Top { get; set; } /// /// 右边距 /// [JsonPropertyName("right")] public string? Right { get; set; } /// /// 下边距 /// [JsonPropertyName("bottom")] public string? Bottom { get; set; } /// /// 左边距 /// [JsonPropertyName("left")] public string? Left { get; set; } }