Hi I wonder if you can help me please.
Hello vincent,
Thanks for using our products.
When filling the data inside PDF form fields, please make sure that the name of the field provided in FillField(...) method is same as present over the PDF form. More along, instead of saving the updated/filled PDF form inside MemoryStream, can you please try saving the file over some physical location over system and see if the updated file contains the data.
In case you still face any problem, please share the source PDF form so that we can test the scenario at our end.
You may also check the following article on Identifying form fields names
We apologize for your inconvenience.
Hi.
Hello Vincent,
Thanks for sharing the information.
Once I have filled the data inside PDF form and I have tried viewing the document, I am getting an error prompt that some rights over the document have been updated and also I have observed that the fields have become flatten. Please take a look over the following error message that I am getting while viewing the document.
We are looking into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
Hi.
Hi Aspose.
Hi Vincent,
I have again tested this issue using your input PDF file and the latest version of Aspose.Pdf.Kit for .NET (4.9.0), but I couldn’t notice any problem. The fields are successfully filled. Could you please make sure that you’re using the latest version? Moreover, please try to use the following constructor for testing purposes:
Form pdfForm = new Form(“Testing vinny.pdf”, “output.pdf”);
If it still doesn’t resolve your issue then please share a small sample application which can help us reproduce the issue at our end. We’ll update you with the results accordingly.
We’re sorry for the inconvenience.
Regards,
Hi shahzad,
Hi Vincent,
I have again tested the issue using your sample - with MemoryStream - but couldn’t notice any problem. The output file was successfully generated and fields were filled properly. Please try the following code snippet which reads the input file into memory stream and then saves the output to the disk from the memory stream:
FileStream inFile = new FileStream(“Testing+vinny.pdf”, FileMode.Open);
FileStream outFile = new FileStream(“output.pdf”, FileMode.Create);
byte[] data = new byte[inFile.Length];
inFile.Read(data, 0, data.Length);
MemoryStream inStream = new MemoryStream(data, 0, data.Length);
MemoryStream outStream = new MemoryStream();
Form pdfForm = new Form(inStream, outStream);
string[] fieldNames = pdfForm.FieldNames;
foreach (string fieldName in fieldNames)
{
//if (partTwoFieldName.StartsWith(“IMAGE-”))
//{
// pdfForm.FillImageField(fieldName, getPDFImageUrl(TemplateImageName));
//}
//else
//{
pdfForm.FillField(fieldName, “some value to be filled”);
//}
}
pdfForm.Save();
outStream.Seek(0, SeekOrigin.Begin);
outStream.WriteTo(outFile);
outFile.Close();
I hope this helps. If it still doesn't resolve your issue then please share a small working sample application which can help us reproduce the same issue at our end.
We're sorry for the inconvenience and looking forward to help you out.
Regards,