-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathIDom2ImageService.cs
More file actions
40 lines (36 loc) · 1.57 KB
/
IDom2ImageService.cs
File metadata and controls
40 lines (36 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace BootstrapBlazor.Components;
/// <summary>
/// IDom2ImageService 接口定义
/// </summary>
public interface IDom2ImageService
{
/// <summary>
/// 通过指定选择器获得 Html 元素返回图片数据
/// </summary>
/// <param name="selector"></param>
/// <param name="options"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<string?> GetUrlAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default);
/// <summary>
/// 通过指定选择器获得 Html 元素返回图片数据流
/// </summary>
/// <param name="selector"></param>
/// <param name="options"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<Stream?> GetStreamAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default);
/// <summary>
/// 通过指定选择器下载 Html 元素图片
/// </summary>
/// <param name="selector"></param>
/// <param name="fileName"></param>
/// <param name="format"></param>
/// <param name="backgroundColor"></param>
/// <param name="options"></param>
/// <returns></returns>
Task DownloadAsync(string selector, string fileName = "capture", string? format = "png", string? backgroundColor = null, Dom2ImageOptions? options = null);
}