44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using HtmlToPdfService.Core.Models;
|
|
using PuppeteerSharp;
|
|
|
|
namespace HtmlToPdfService.Core.Services;
|
|
|
|
/// <summary>
|
|
/// 图片转换服务接口
|
|
/// </summary>
|
|
public interface IImageService
|
|
{
|
|
/// <summary>
|
|
/// 将 HTML 内容转换为图片
|
|
/// </summary>
|
|
Task<ConversionResult> ConvertHtmlToImageAsync(
|
|
string html,
|
|
ScreenshotOptions? options = null,
|
|
int? viewportWidth = null,
|
|
int? viewportHeight = null,
|
|
int? delayAfterLoad = null,
|
|
string? callbackUrl = null,
|
|
Dictionary<string, string>? callbackHeaders = null,
|
|
bool? includePdfInCallback = null,
|
|
bool? saveLocal = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 将 URL 转换为图片
|
|
/// </summary>
|
|
Task<ConversionResult> ConvertUrlToImageAsync(
|
|
string url,
|
|
ScreenshotOptions? options = null,
|
|
int? viewportWidth = null,
|
|
int? viewportHeight = null,
|
|
WaitUntilNavigation[]? waitUntil = null,
|
|
int? timeout = null,
|
|
int? delayAfterLoad = null,
|
|
string? callbackUrl = null,
|
|
Dictionary<string, string>? callbackHeaders = null,
|
|
bool? includePdfInCallback = null,
|
|
bool? saveLocal = null,
|
|
CancellationToken cancellationToken = default);
|
|
}
|
|
|