We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Checkboxes not filled with ImportXml() of Aspose.Pdf.Kit for .Net

Hi,

I am working on trial version of Aspose.Pdf.Kit (4.3.0.0) and am trying to use ImportXml() API to fill the form fields of my PDF template. In the generated output PDF file, the data for all fileds are populated excepting checkboxes. I have tried with the values (1/0, Yes/No, true/false) for the checkboxes but without success. I am attaching thePDF template as well as the input Xml file with this post. Please help in resolving the issue.

Regards,

Dinesh

Hi Dinesh,

You need to use On to select a checkbox and Off to deselect it. Please try it at your end and if you still find any issues or need further assistance, please do let us know.

Regards,

Hi Shahzad,

I have tried with On/Off values earlier and was receiving an error message while opening the generated PDF (Please see attachment) indicating that Off is not a valid value. When I used values 0/1, the error message was gone but checkboxes were not populated.

Infact I have tried it on 2.6.3.0 version of Aspose.Pdf.Kit.dll for which I have license and wanted to verify whether it had been addressed on latest version (trial) so that I can upgrade to new version. Appreciate your help in quick resolution for the same.

Regards,

Dinesh

Hi Dinesh,

The actual values are On/Off as you can see in this demo. You can download the related XML file as well. Please download the latest version (Aspose.Pdf.Kit for .NET 4.3.0) and try it at your end. I have tried it at my end however, I have noticed a different problem, that is none of the fields are filled at all. I just wanted to see if that is the same problem you’re facing with this latest version or it is different.

Please share the results with us, so we could help you out accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,

I have tried with a small example as per your instruction with version 4.3.0 and here is my souce code

public static void ImportXml()

{

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

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

System.IO.FileStream xmlInputStream = new FileStream(@"C:\Temp\WebApplication1\WebApplication1\InputXml.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();

}

I am attaching the output PDF file(PTO-SB-01 v04-09OUT.pdf) along with template PDF (PTO-SB-01 v04-09.pdf) and input Xml (InputXml.xml). You can see that output PDF has all fields filled excepting checkboxes.

In my templatePDF, all the checkboxes are defined with the same name "CheckBox1". Could this be the cause of problem?

Also, I have noticed the format of XML in the demo suggested by you is something like this

<?xml version="1.0" encoding="utf-8" ?>

<fields>
<field name="Telephone">
<value>888.277.6734</value>
</field>
...
...
</fields>

Whereas my input xml used in the above example is in format as below

<?xml version="1.0" encoding="utf-8"?>
http://www.w3.org/1999/XSL/Format">

PAT-0001-US-PSP
...

...

Off
...

On



...



...


http://www.xfa.org/schema/xfa-data/1.0/" />

Please advice if this is valid input xml.

Thanks & Regards,

Dinesh

Hi Dinesh,

Thank you very much for sharing the details. We’ll investigate it in detail and update you accordingly.

We’re sorry for the inconvenience.
Regards,

Hi,

Any updates in this regard?

Regards,

Dinesh

Hi Dinesh,

The structure of this sample file is similar to the one you already shared in this post and I’m having the similar issue with this file as well, that is unable to fill the fields at all. We’ll need to test this file once the issue mentioned in the above post is resolved. You’ll be updated with the further progress on this issue accordingly.

We’re sorry for the inconvenience.
Regards,

Shahzad,

Thanks for the update. Meanwhile, could you suggest if there is any other alternate workaround that I can do for the same.

Thanks

Dinesh

Hi Dinesh,

I’m very sorry to inform you that currently we can’t share some alternative workaround for this issue.

We’re sorry for the inconvenience.
Regards,

Hi Dinesh,

I have logged this issue as PDFKITNET-17434 in our issue tracking system. Our team will investigate this issue in detail and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

Hi,

Any news? Please let me know as to when I can get a solution so that I can commit the same to my customer.

Regards,

Dinesh

Hi Dinesh,

I’m sorry to inform you that this issue is not yet resolved and I’m afraid we’re unable to share the ETA at the moment. Our team needs to further investigate this issue. You’ll be updated with the ETA as we get some idea.

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 to deliver this report and will appreciate quick help.

Regards,

Dinesh

Hi Dinesh,

Our team is working on this issue and, if everything goes well, we’re very much hopeful that the fix for this issue will be available in our upcoming monthly release due at the end of this month.

We’re sorry for the inconvenience.
Regards,

Hi,

I have downloaded the hotfix (4.5.0.1) provided by you in this post and it resolved most of my checkbox issues where the checkbox expects either 0 or 1 as values. I had also renewed my license for Aspose.Total. However, I found that for few forms, the checkbox issue still exists and have noticed that these templates require either On/Off or Yes/No as values for checkboxes but does not work even if I provide those values. I am attaching four of the templates, XML files and generated pdfs as attachments that are problematic. The naming convention for each pdf template is xxx.pdf, for XML it is xxx_data.xml and for generated pdf it is xxx_OUT.pdf. Here is the source code that I had used to generate the documents

Aspose.Pdf.Kit.License pdfLicense = new Aspose.Pdf.Kit.License();

pdfLicense.SetLicense(@"C:\Temp\Aspose.Total.lic");

Form form = new Form(@"C:\Temp\PTO-SB-31 v07-09.pdf", @"C:\Temp\PTO-SB-31 v07-09_OUT.pdf");

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

form.ImportXml(xmlInputStream);

form.Save();

xmlInputStream.Close();

As I had mentioned earlier, I am in a very critical situation with my customer and your timely help would be appreciated.

Thanks

Dinesh

Hi Dinesh,

We’ll test these issue at our end in detail, however in the meanwhile can you please try the latest version (4.6.0) at your end and share the results?

We’re sorry for the inconvenience.
Regards,

Shahzad,

I had downloaded the version 4.6.0 and tested with the same templates. The reults are exactly the same as mentioned in my previous email.

Regards,

Dinesh

Hi Dinesh,

I have reproduced these problems at my end and logged them as shown below:

PDFKITNET-18299: PTO-SB-31 v07-09.pdf
PDFKITNET-18300: PTO-SB-22 v07-09.pdf
PDFKITNET-18301: 1002 v12-07.pdf
PDFKITNET-18302: 1001 v05-10.pdf

Our team will investigate these issues and you’ll be updated via this forum thread once they’re resolved. Moreover, I would like to add that, please try to export the data first to XML, so you should get a better idea that how the CheckBox values are defined in the PDF file; as I have exported these files the values are defined as On/Off, while you’re passing these values as Yes/No; although, the checkboxes are not filled with the modified values either, nevertheless this might help you in future.

We’re sorry for the inconvenience.
Regards,

Hi,

Any updates about the fix?

Regards,

Dinesh