We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Open PDF Document Set perrmission and re-save

Hi,

I have a really old verison of the PDF toolkit, but I was hoping I can still do this simple task with it.

I want to open a PDF document change it’s permissions and then re-save it.

I was trying something like this but it is not working.

//Instantiating PdfFileSecurity object
Aspose.Pdf.Security fileSecurity = new Aspose.Pdf.Security();
fileSecurity.IsCopyingAllowed = false;
fileSecurity.IsScreenReadersAllowed = true;
fileSecurity.IsContentsModifyingAllowed = false;
fileSecurity.IsAnnotationsModifyingAllowed = false;
fileSecurity.IsPrintingAllowed = true;

System.IO.FileStream s = new System.IO.FileStream(TempPDF, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf(s);

pdf.Security = fileSecurity;
//pdf.Save(s);
pdf.Close();

Hi Adam,

As I can see, you’re trying to use Aspose.Pdf for updating security settings of an existing PDF file. I would like to share with you that Aspose.Pdf only allows you to create PDF files from scratch and hence set related properties along the way.

If you’re interested to manipulate existing PDF file or set its properties, you can use Aspose.Pdf.Kit. In order to set the security privileges please have a look at this example. Moreover, we have fixed certain issues in our older versions, so please make sure that you use the latest version at your end to get accurate results.

I hope this helps. If you have any further questions, please do let us know.
Regards,