namespace HtmlToPdfService.Core.Options;
///
/// PDF 服务配置选项(主配置)
///
public class PdfServiceOptions
{
///
/// 浏览器池配置
///
public BrowserPoolOptions BrowserPool { get; set; } = new();
///
/// 存储配置
///
public StorageOptions Storage { get; set; } = new();
///
/// 回调配置
///
public CallbackOptions Callback { get; set; } = new();
///
/// PDF 默认转换配置
///
public DefaultPdfOptions DefaultPdfOptions { get; set; } = new();
///
/// 转换配置
///
public ConversionOptions Conversion { get; set; } = new();
}
///
/// PDF 默认转换配置
///
public class DefaultPdfOptions
{
///
/// 纸张格式
///
public string Format { get; set; } = "A4";
///
/// 是否横向
///
public bool Landscape { get; set; } = false;
///
/// 是否打印背景
///
public bool PrintBackground { get; set; } = true;
///
/// 是否优先使用 CSS 定义的页面大小
///
public bool PreferCSSPageSize { get; set; } = false;
///
/// 页边距
///
public MarginOptions Margin { get; set; } = new();
}
///
/// 页边距配置
///
public class MarginOptions
{
public string Top { get; set; } = "10mm";
public string Right { get; set; } = "10mm";
public string Bottom { get; set; } = "10mm";
public string Left { get; set; } = "10mm";
}
///
/// 转换配置
///
public class ConversionOptions
{
///
/// 默认转换超时时间(毫秒)
///
public int DefaultTimeout { get; set; } = 60000;
///
/// 默认等待条件
///
public string DefaultWaitUntil { get; set; } = "networkidle2";
///
/// 最大 HTML 内容大小(字节)
///
public int MaxHtmlSize { get; set; } = 10485760; // 10MB
}