Form field checkbox throws XML parsing error- but data is populated

Hi everyone,

I am using aspose.pdf.kit 5.4.0.0 with original license. The pdf is created using adobe acrobat 6.0 professional.

It works fine for normal text field but not with checkbox. Whenever I call the print event, it will prompt me to save/open the pdf. And when i choose open, it will prompt me the error below.

Error:-

xml parsing error: not well-formed (invalid token) (error code 4), line 206, column 37360 of file

Surprising after i press okay, it will show the checkbox is being ticked. Just I am not sure why the xml parsing error exists. If I don’t do formfield on checkbox, it worked fine without the xml parsing error.

Below is my code for print event:-

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();
license.SetLicense(“Aspose.Pdf.Kit.lic”);

Response.AddHeader(“content-disposition”, “attachment; filename=” + “TransactionSlip.pdf”);
Response.ContentType = “application/pdf”;

Form form = new Form(EnrollmentPath, Response.OutputStream);
form.FillField(“name”, “chua wen ching”); // property: name
form.FillField(“1_1”, true); // property: 1_1
//form.FillField(“topmostSubform[0].Page1[0].1_1[0]”, true); // tried this, no difference
form.Save();
Response.End();

Hi Wen,

Thank you very much for considering Aspose.

Are you having this problem on opening the PDF file after filling it with Aspose.Pdf.Kit? Or you’re having this problem when you print the PDF file using PdfViewer class of Aspose.Pdf.Kit? Please elaborate your issue in detail and also please share the input PDF file (before filling) with us, so we could test the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

I got it working already.

This is quite weird i can say.

The original pdf form was created in adobe designer 7.0 by my other colleague. I needed to modify it and i had only adobe acrobat 6.0 professional software with me. Even though i modified the document using 6.0, but properties need to comply with the 7.0 standards.

This only applies to checkbox. Textfield works just fine.

So instead of having the checkbox field name as 1_1, I need to change it to

topmostSubform[0].Page1[0]._1_1[0]

it has to be that format. It will not work if it is

topmostSubform[0].Page1[0].1_1[0]
or 1_1 or anything else.

I just redo the renaming properties again and it worked charm right now.

Hi Wen,

As I have understood, this name change issue is caused due to the different versions of the Adobe Acrobat. However, I’m glad to know that you have worked it out.

If you find any further questions, please do let us know.
Regards,