I have a pdf that is already in a MemoryStream object. I need to make the pdf protected with a user password before I email it out. I've tried a bunch of stuff and just can't seem to get it. Here's what I have so far, but this generates an emtpy pdf when I write it to a file.
(The last 4 lines are for debugging purposes only. I don't want to actually write this to a file, I need a memory stream).
Would you mind giving me some assistance?
Aspose.Pdf.Pdf p = new Aspose.Pdf.Pdf(stream);
p.Security = new Aspose.Pdf.Security();
p.Security.UserPassword = password;
FileStream outStream = File.OpenWrite(@"e:\pdffiles\output.pdf");