If I create a license ( Aspose.Pdf.Kit.License lic = new Aspose.Pdf.Kit.License();
FileStream myStream = new FileStream("Aspose.Pdf.Kit.lic", FileMode.Open);
lic.SetLicense(myStream);
myStream.Close();)
before or in the following method I receive an error. System.NotSupportedException (Memory Stream is not expandable)
If I don't create a license it works as it should (all be it with the demo text)
private static byte[] RenderReadOnly(byte[] incoming)
{
MemoryStream inStream = new MemoryStream(new byte[incoming.Length]);
inStream.Write(incoming, 0, incoming.Length);
MemoryStream outStream = new MemoryStream(new byte[incoming.Length]);
PdfFileSecurity pdfs = new PdfFileSecurity(inStream, outStream);
try
{
pdfs.SetPrivilege(DocumentPrivilege.Print); // error occures here.
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
inStream.Close();
outStream.Close();
byte[] result = outStream.ToArray();
pdfs = null;
return result;
}