Free Support Forum - aspose.com

Form fields updated incorrectly

I have a PDF template with same field names for all fields of similar type(please see attached file PTO-SB-45 v03-09.pdf) and am importing the attached XML file with data(PTO-SB-45.xml generated with same field names used in PDF template). When I use the ImportXml() method of Aspose.Pdf.Kit(version 4.3.0) to generate the pdf document(attachment : PTO-SB-45 v03-09 OUT.pdf), only one of the fields is getting filled and also it is filled in wrong location. Here is the sample code that I am using to generate the PDF.

Form form = new Form(@"C:\Temp\PTO-SB-45 v03-09.pdf", @"C:\Temp\PTO-SB-45 v03-09 OUT.pdf");

//Create an XML file as a FileStream that contains the contents of the PDF document

System.IO.FileStream xmlInputStream = new FileStream(@"C:\Temp\PTO-SB-45.xml", FileMode.Open);

//Import the values from the XML file to the PDF form

form.ImportXml(xmlInputStream);

//Save the output PDF document

form.Save();

//Close the input XML stream

xmlInputStream.Close();

In the XML file, I have many tags with the name same name <TextField1>, and with different values. After importing, the output PDF is having the first field with bookmark name "TextField1" filled with the last node value having the same name "<TextField1>+33 142501910</TextField1> " from XML file. All other fields are empty in the generated PDF file. But my requirement is to fill the form fields with data from XML file in the same order i.e, the first field in PDF template with bookmark name "TextField1" should be filled with the data from first node of XML with name "TextField1". Similarly the second field in PDF template with bookmark name "TextField1" should be filled with the data from second node of XML with name "TextField1".

Please help me in resolving this issue

Regards,

Dinesh

Hi Dinesh,

Can you please assign a unique name to each field, both in the PDF file and XML file, and try with that scenario? If not, can you please elaborate your scenario that why you would like to keep all the fields with the same name?

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Hi shahzad,

Actually, I receive the PDF template from Patent Office of a specific country and I am not supposed to change it. Hence I have used the export XML feature of Aspose to generate the XML template, filled it with my data and then trying to import the data into PDF using ImportXML() feature. Here I am facing the problem of incorrect field updation. Can you please help me resolve the same?

Thanks

Dinesh

Hi Dinesh,

Thank you very much for sharing further information with us. We’ll investigate this issue in detail at our end and you’ll be updated accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Dinesh,

I have reproduced this problem at my end and logged it as PDFKITNET-16653 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

Hi,

Any news about the solution?

Regards,

Dinesh

Hi Dinesh,

Our team is working on this issue and have made some progress. We’ll try to provide you the resolution for this issue the earliest possible.

We’re sorry for the inconvenience.
Regards,

Hi,

Thanks for the update. I really appreciate if you can give me a tentative date so that I can keep my customers informed. Otherwise, request you to suggest any alternate workaround for the same.

Thanks & Regards,

Dinesh

Hi Dinesh,

I hope we’ll be able to share the ETA of this issue in the next week.

We’re sorry for the inconvenience and appreciate your patience.
Regards,

Hi,

Any news about this?

Regards,

Dinesh

Hi Dinesh,

I’m sorry to inform you that this issue is not yet resolved. Our team is currently working on this issue and we’ll try to provide you the ETA the earliest possible.

We’re sorry for the inconvenience.
Regards,

Hi,

Just to let you know that I had tried the same with my licensed copy of Aspose.Pdf.Kit for version 2.6.3.0. I am in critical situation with my customer and will appreciate quick help.

Regards,

Dinesh

Hi Dinesh,

This issue is resolved in the latest hot fix (4.5.0.1). The hot fix can be found attached with this post. Please download it and try at your end.

I hope this helps. If you have any further questions, please do let us know.
Regards,