I am using Aspose PDF version 8.50.
I am creating a Pdf document and want to set a password. My current code doesn't work:
IO.MemoryStream PdfStream = new IO.MemoryStream();
PdfMergeDoc.Save(PdfStream);
PdfStream.Position = 0;
Aspose.Pdf..Generator.Pdf PdfSec = new Aspose.Pdf.Generator.Pdf(PdfStream);
PdfStream.Flush();
PdfSec.Security = new Aspp.Generator.Security();
PdfSec.Security.MasterPassword = "pw";
PdfSec.Save(PdfMergeDateipfadSec);
PdfMergeDoc is an Aspose.Pdf.Document object I have created, PdfMergeDateipfadSec is just the file path for the password protected document.
Although the stream is not empty the save method doesn't write the file.
I could not find a better example in the documentation than the one that creates an empty pdf document.
Please help,
Regards,
Petrow