Preserving Adobe Extended Features

Is it possible to preserve adobe extended features when applying/removing privileges and/or when stamping a watermark? It does not seem to be working for me.

@bobli123

You can use incremental saving approach using FileStream in order to preserve extended features as follows:

FileStream fs = new FileStream(dataDir + "input.pdf", FileMode.Open, FileAccess.ReadWrite);
// Instantiate Document instance
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fs);
// Perform other stuff
// Save the updated document in save FileStream
pdfDocument.Save();
// Close the File Stream object
fs.Close();

In case you face any issue, please share your sample PDF along with sample code snippet. We will test the scenario in our environment and address it accordingly.

Would the same be possible when using a memory stream (which has the bytes to a pdf), instead of a filestream? (Which is what I’m trying to do at the moment)

sample1.pdf (146.4 KB)
When I try and use the following code

            FileStream fs = new FileStream(@"C:\sample1.pdf", FileMode.Open, FileAccess.ReadWrite);
            // Instantiate Document instance
            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fs);
            // Perform other stuff

            var fileSecurity = new PdfFileSecurity(pdfDocument);
            var privilege = DocumentPrivilege.AllowAll;

            PdfFileSignature sign = new PdfFileSignature();
            sign.BindPdf(pdfDocument);
            sign.RemoveUsageRights();

            privilege.AllowPrint = true;
            privilege.AllowDegradedPrinting = true;

            fileSecurity.SetPrivilege(privilege);

            // Save the updated document in save FileStream
            pdfDocument.Save();
            // Close the File Stream object
            fs.Close();

and open the file on adobe acrobat reader dc, I get the message “Please fill out the following form. You cannot save data typed into this form.”

@bobli123

We are testing the scenario and will get back to you soon.

Alright, thanks!