using HtmlToPdfService.Core.Models;
using PuppeteerSharp;
using PuppeteerSharp.Media;
namespace HtmlToPdfService.Core.Services;
///
/// PDF 转换服务接口
///
public interface IPdfService
{
///
/// 将 HTML 内容转换为 PDF
///
/// HTML 内容
/// PDF 选项
/// 回调 URL(可选)
/// 回调自定义 Headers(可选)
/// 是否在回调中包含 PDF 数据
/// 是否保存本地副本
/// 取消令牌
/// 转换结果
Task ConvertHtmlToPdfAsync(
string html,
PdfOptions? options = null,
string? callbackUrl = null,
Dictionary? callbackHeaders = null,
bool? includePdfInCallback = null,
bool? saveLocal = null,
CancellationToken cancellationToken = default);
///
/// 将 URL 转换为 PDF
///
/// URL 地址
/// PDF 选项
/// 等待条件
/// 页面加载超时(毫秒)
/// 回调 URL(可选)
/// 回调自定义 Headers(可选)
/// 是否在回调中包含 PDF 数据
/// 是否保存本地副本
/// 取消令牌
/// 转换结果
Task ConvertUrlToPdfAsync(
string url,
PdfOptions? options = null,
WaitUntilNavigation[]? waitUntil = null,
int? timeout = null,
string? callbackUrl = null,
Dictionary? callbackHeaders = null,
bool? includePdfInCallback = null,
bool? saveLocal = null,
CancellationToken cancellationToken = default);
}