Determine if PDF has fillable form fields permission allowed or not using Aspose.PDF for .NET

Hi,
How will I come to know if a pdf file is fillable form or no. Please help me out with this.

@rampujar,

Thanks for contacting support.

You may check Count Property of Form Class of a Document type, in order to determine whether a PDF contains forms or not. Please check following code snippet:

Document doc = new Document(dataDir + "input.pdf");
var count = doc.Form.Count; 

In case you are unable to achieve what you require, please share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.

Hi
I am not able get the count property for the fallible form ,Like there are pdf security setting page extraction,copy protection ,document assambly) similarly i need to get form fillabel is allowed or no

regards
Thanks

@rampujar,

Can you please share sample code and source files with us. We will investigate this on our end to help you out.

image.png (72.3 KB)

in above image has filling of form fields :Allowed ,
here if the filling of form fields not Allowed then how can handel that type security through Api ,there is no any api for this type of security

Hi
image.png (72.3 KB)

in above image has filling of form fields :Allowed ,
here if the filling of form fields not Allowed then how can handel that type security through Api ,there is no any api for this type of security

Regards
Suraj

@rampujar,

I have observed the requirements shared by you and have created an investigation ticket with ID PDFNET-48019 in our issue tracking system to investigate whether it is possible to meet the illustrated requirements using Aspose.Slides or not. I will share the feedback with you in this regard as soon as possible.

@rampujar

Yes, you can achieve your requirements by using Aspose.PDF for .NET. You can use encrypt with empty user-password and set DocumentPrivilege.

var document = new Aspose.Pdf.Document(dataDir + "short.pdf");
using (var sec = new PdfFileSecurity(document))
{
    var per = DocumentPrivilege.AllowAll;
    per.AllowAssembly = false;
    sec.EncryptFile("", "owner password", per, KeySize.x256);
    sec.Save(dataDir + "result.pdf");
}

You can change DocumentPrivilege as you wish.