I'm facing a problem with a Web API I have that receives a PDF document (PDF form) as a base64 encoded string, makes it into a file, fills in some of the fields (using iTextSharp PdfStamper
class) and sends the result back as a base64 encoded string, where it is again made into a file.
When I try to open this file/document afterwards with Foxit Reader I can still edit the fields, but when trying the same with Adobe Acrobat Reader, the fields are no longer editable.
When opening the property page and viewing the security properties for the document in Foxit Reader, it says that everything is allowed. However, when doing the same in Adobe Acrobat Reader, it says that commenting, filling in fields and signing isn't allowed (which it was prior to sending it to the API).
Unfortunately I can't dictate which PDF reader the end users are using, so I need this to be universal.
I can see that many others have posted about similar issues, but I don't see my particular issue in there.
Does anyone know what is going on here and how to get around it?
EDIT: code added
I'm doing this (tiny bit simplified, but the same):
PdfReader reader = new PdfReader("path to PDF form file");
stamp = new PdfStamper(reader, new FileStream("path to filled PDF form file", FileMode.Create));
AcroFields form = stamp.AcroFields;
IDictionary<string, AcroFields.Item> fs = form.Fields;
foreach (var f in fs)
{
form.SetField(f.Key, "some value");
}
stamp.Close();
EDIT: sample PDF files added
The sample files are just something found on the internet, as I recall it was linked in another post in here.
I have tried to fill in 2 fields (firstname and lastname) in this PDF form.
The first file is the form created from base64 string.
d94b6076-983d-47db-b496-a0ba383deda4.pdf
The second file is the output after filling in the 2 fields.