- PdfConversionOptions 新增 Width/Height(自定义纸张尺寸)和 ViewportWidth/ViewportHeight(浏览器视口) - PuppeteerPdfService 渲染前设置视口,BuildPdfOptions 支持自定义宽高优先于预设Format - ConversionTask 新增 PdfWidth/PdfHeight 字段 - 全链路透传:API DTO → TaskOrchestrator → TaskProcessor → PuppeteerPdfService - Client SDK PdfOptions 同步更新 - 新增 docs/外部对接文档.md
91 lines
2.2 KiB
C#
91 lines
2.2 KiB
C#
using System.Text.Json.Serialization;
|
||
|
||
namespace HtmlToPdfService.Client.Models;
|
||
|
||
/// <summary>
|
||
/// PDF 转换选项
|
||
/// </summary>
|
||
public class PdfOptions
|
||
{
|
||
/// <summary>
|
||
/// 页面格式,如 A4, Letter, Legal 等
|
||
/// </summary>
|
||
[JsonPropertyName("format")]
|
||
public string? Format { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否横向
|
||
/// </summary>
|
||
[JsonPropertyName("landscape")]
|
||
public bool? Landscape { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否打印背景
|
||
/// </summary>
|
||
[JsonPropertyName("printBackground")]
|
||
public bool? PrintBackground { get; set; }
|
||
|
||
/// <summary>
|
||
/// 页边距设置
|
||
/// </summary>
|
||
[JsonPropertyName("margin")]
|
||
public MarginOptions? Margin { get; set; }
|
||
|
||
/// <summary>
|
||
/// 自定义页面宽度,支持单位:px, in, cm, mm(如 "1309px", "210mm")
|
||
/// 设置后将忽略 Format 参数
|
||
/// </summary>
|
||
[JsonPropertyName("width")]
|
||
public string? Width { get; set; }
|
||
|
||
/// <summary>
|
||
/// 自定义页面高度,支持单位:px, in, cm, mm(如 "926px", "297mm")
|
||
/// 设置后将忽略 Format 参数
|
||
/// </summary>
|
||
[JsonPropertyName("height")]
|
||
public string? Height { get; set; }
|
||
|
||
/// <summary>
|
||
/// 浏览器视口宽度(像素),控制页面渲染时的窗口宽度
|
||
/// </summary>
|
||
[JsonPropertyName("viewportWidth")]
|
||
public int? ViewportWidth { get; set; }
|
||
|
||
/// <summary>
|
||
/// 浏览器视口高度(像素),控制页面渲染时的窗口高度
|
||
/// </summary>
|
||
[JsonPropertyName("viewportHeight")]
|
||
public int? ViewportHeight { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 页边距选项
|
||
/// </summary>
|
||
public class MarginOptions
|
||
{
|
||
/// <summary>
|
||
/// 上边距(如 "10mm")
|
||
/// </summary>
|
||
[JsonPropertyName("top")]
|
||
public string? Top { get; set; }
|
||
|
||
/// <summary>
|
||
/// 右边距
|
||
/// </summary>
|
||
[JsonPropertyName("right")]
|
||
public string? Right { get; set; }
|
||
|
||
/// <summary>
|
||
/// 下边距
|
||
/// </summary>
|
||
[JsonPropertyName("bottom")]
|
||
public string? Bottom { get; set; }
|
||
|
||
/// <summary>
|
||
/// 左边距
|
||
/// </summary>
|
||
[JsonPropertyName("left")]
|
||
public string? Left { get; set; }
|
||
}
|
||
|