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#

using iText.Kernel.Pdf;
namespace DS.Module.Core.Utils
{
/// <summary>
/// PDF处理工具类
/// </summary>
public static class PDFUtil
{
public static async void AddStrampAsync(this Stream stream)
{
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);
}
var pdfReader = new PdfReader(stream);
}
}
}