Hi,
I have 2 pdf, that I attached. input1.pdf after saving is not fillable anymore. While input2.pdf after saving is still fillable. I don’t understand the reason. I tried setting the security options through PdfFileSecurity for input1, but still doesn’t work.
input1.pdf (1.0 MB)
input2.pdf (1.5 MB)
This is the code for just saving after opening:
Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document(@"c:\test\input1.pdf");
Aspose.Pdf.Document doc2 = new Aspose.Pdf.Document(@"c:\test\input2.pdf");
var output1_path = @"c:\test\output1.pdf";
var output2_path = @"c:\test\output2.pdf";
doc1.Save(output1_path);
doc2.Save(output2_path);
I tried this code also to set privileges:
var output_pdf_path = @"c:\test\output1.pdf";
var privilege = DocumentPrivilege.AllowAll;
privilege.AllowFillIn = true;
privilege.ChangeAllowLevel = 1;
using (var fileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity())
{
fileSecurity.BindPdf(@"c:\test\input1.pdf");
fileSecurity.SetPrivilege(privilege);
fileSecurity.Save(output_pdf_path);
}
@zhinous.shokrani
Cause
The issue you’re experiencing with input1.pdf
becoming non-fillable after saving is likely due to the PDF’s structure or the settings used during the save operation. Different PDFs can have varying levels of compatibility with form fields, and certain operations might inadvertently alter their properties.
Solution
To ensure that the form fields remain fillable after saving, follow these steps:
-
Use PdfSaveOptions: When saving the document, utilize PdfSaveOptions
to specify that you want to preserve form fields. This will help maintain the fillable properties of the fields.
-
Check Form Field Properties: Ensure that the form fields in input1.pdf
are correctly defined and not set to read-only or have any restrictions that might prevent them from being fillable after saving.
Code
Here’s an example of how to save the PDF while preserving the form fields:
using Aspose.Pdf;
var inputPath1 = @"c:\test\input1.pdf";
var outputPath1 = @"c:\test\output1.pdf";
using (var document = new Document(inputPath1))
{
var pdfSaveOptions = new PdfSaveOptions
{
PreserveFormFields = true // Ensure form fields are preserved
};
document.Save(outputPath1, pdfSaveOptions);
}
Next Steps
- Test the above code with
input1.pdf
to see if it resolves the issue.
- If the problem persists, check the properties of the form fields in
input1.pdf
to ensure they are correctly configured.
- Compare the properties of both PDFs (
input1.pdf
and input2.pdf
) to identify any differences that could be affecting the fillable status.
Please implement these steps and let me know the outcome!
PreserveFormFields doesn’t exist in pdfSaveOptions of Aspose.pdf
I only found signaturesappendonly property of the Form property is true on input1 but don’t know if it’s the reason and even after setting to false, still doesn’t save as fillable.
Screenshot 2025-07-10 104716.png (15.9 KB)
@zhinous.shokrani
Have you tried using the latest version of the API? Can you please share the generated outputs for our reference as well? We will look into its details and address it accordingly.