17 lines
563 B
C#

#if NETFRAMEWORK
using System.IO;
#endif
namespace EnvelopeGenerator.PdfEditor
{
public static class Extensions
{
/// <summary>
/// Writes the stream contents to a byte array, regardless of the System.IO.MemoryStream.Position property.
/// </summary>
/// <typeparam name="TPdf"></typeparam>
/// <param name="pdf"></param>
/// <returns>A new byte array</returns>
public static byte[] ToBytes<TPdf>(this TPdf pdf) where TPdf : Pdf<MemoryStream, MemoryStream> => pdf.OutputStream.ToArray();
}
}