add OutputStream getter
This commit is contained in:
@@ -7,6 +7,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace EnvelopeGenerator.PdfEditor
|
||||
{
|
||||
public static class Edit
|
||||
{
|
||||
public static Edit<MemoryStream, MemoryStream> FromMemory(byte[] documentBytes)
|
||||
{
|
||||
return new Edit<MemoryStream, MemoryStream>(new MemoryStream(documentBytes), new MemoryStream());
|
||||
}
|
||||
}
|
||||
|
||||
public class Edit<TInputStream, TOutputStream> : IDisposable, IAsyncDisposable
|
||||
where TInputStream : Stream
|
||||
where TOutputStream : Stream
|
||||
@@ -26,6 +34,26 @@ namespace EnvelopeGenerator.PdfEditor
|
||||
_doc = new PdfDocument(_reader, _writer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the output stream containing the edited PDF document.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Accessing this property will close the underlying <see cref="PdfDocument"/> to ensure
|
||||
/// all changes are flushed to the stream. After accessing this property, the PDF document
|
||||
/// can no longer be modified using this <see cref="Edit{TInputStream, TOutputStream}"/> instance.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// The <typeparamref name="TOutputStream"/> instance that contains the updated PDF bytes.
|
||||
/// </returns>
|
||||
public TOutputStream OutputStream
|
||||
{
|
||||
get
|
||||
{
|
||||
_doc.Close();
|
||||
return _outputStream;
|
||||
}
|
||||
}
|
||||
|
||||
public static Edit<MemoryStream, MemoryStream> OnByte(byte[] documentBytes)
|
||||
{
|
||||
return new Edit<MemoryStream, MemoryStream>(new MemoryStream(documentBytes), new MemoryStream());
|
||||
|
||||
Reference in New Issue
Block a user