I don’t see the ability to control the restrictions on the document to manage those properties. This is something we currently have with a competitor of yours but cannot find the equivalent in your API. Can you confirm if it’s possible to manage the properties shown in the image below.
There is already an issue logged in our issue tracking system as PDFNET-46708. This was related to the determining whether Page Extraction privilege is allowed or not. Against your original inquiry, we tried below code snippet:
// Allow all the privileges
Facades.DocumentPrivilege documentPrivilege = Facades.DocumentPrivilege.AllowAll;
Document doc = new Document();
doc.Pages.Add().Paragraphs.Add(new TextFragment("Hello World"));
Facades.PdfFileSecurity pdfFileSecurity = new Facades.PdfFileSecurity();
pdfFileSecurity.BindPdf(doc);
pdfFileSecurity.SetPrivilege(documentPrivilege);
pdfFileSecurity.Save(dataDir + "output.pdf");
As in the above code snippet, we allowed all privileges but Page Extraction and Document Assembly were Not Allowed in the output PDF.
We then used following code snippet:
// Allow all the privileges
Facades.DocumentPrivilege documentPrivilege = Facades.DocumentPrivilege.AllowAll;
// Disable them one by one to see whether all are disabled or not
documentPrivilege.AllowModifyContents = false;
documentPrivilege.AllowDegradedPrinting = false;
documentPrivilege.AllowPrint = false;
documentPrivilege.AllowCopy = false;
documentPrivilege.AllowAssembly = false;
documentPrivilege.AllowFillIn = false;
documentPrivilege.AllowModifyAnnotations = false;
documentPrivilege.AllowScreenReaders = false;
Document doc = new Document();
doc.Pages.Add().Paragraphs.Add(new TextFragment("Hello World"));
Facades.PdfFileSecurity pdfFileSecurity = new Facades.PdfFileSecurity();
pdfFileSecurity.BindPdf(doc);
pdfFileSecurity.SetPrivilege(documentPrivilege);
pdfFileSecurity.Save(dataDir + "output.pdf");
Now all privileges were “Not Allowed”. But, please note that “Page Extraction” and “Document Assembly” were no where in the above code to be set and they always were “Not Allowed” even after using Facades.DocumentPrivilege.AllowAll. There should be all properties as in the attached image to set using the API. “Page Extraction” privilege comes under DocumentPrivilege.ChangeAllowLevel which only has setter. It also refers to other document privileges like signing document.
We have updated the earlier logged ticket according to the details shared above and linked it to this forum thread. This way you will be notified as soon as the ticket is resolved. Please be patient and spare us some time.