I'm using PDFSharp to generate a PDF document with fields filled in. When the doc is saved, I'd like it to be read-only, aka flattened. I've tried the below, but still, when opening the PDF in Adobe, the fields are editable.
using (PdfDocument form = PdfReader.Open(outputFormLocation , PdfDocumentOpenMode.Modify))
{
//do stuff...
//Save
PdfSecuritySettings securitySettings = form.SecuritySettings;
securitySettings.PermitFormsFill = false;
securitySettings.PermitModifyDocument = false;
securitySettings.PermitPrint = true;
form.Save(outputFormLocation);