You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
700 B
C#

1 month ago
using iText.Kernel.Pdf;
namespace DS.Module.Core.Utils
{
/// <summary>
/// PDF处理工具类
/// </summary>
public static class PDFUtil
{
1 month ago
public static async void AddStrampAsync(this Stream stream)
1 month ago
{
1 month ago
ArgumentNullException.ThrowIfNull(stream, nameof(stream));
if (!stream.CanRead)
throw new ArgumentException("流不支持读取", nameof(stream));
var pdfStream = stream;
if (!stream.CanWrite)
{
pdfStream = new MemoryStream();
await stream.CopyToAsync(pdfStream);
}
1 month ago
var pdfReader = new PdfReader(stream);
1 month ago
1 month ago
}
}
}