Reading form fields created from xml

Hi,

We’ve been using creation of pdf’s using the BindXml method for several years now.
Now we need to add form fields to a PDF, and are trying to send something like this, inside a table cell:
< FormField FormFieldType=“Text” FieldName=“formFieldTest”>

But when we then open the saved pdf file and try to access the Form list fields, it is empty.

Could you please advise on what we are missing? Is there some additional setting on the xml?

Thanks in advance,
Paulo

@hh.paulo.silva

Would you please share your complete XML file for our reference and please share which API version are you using?

Hi,

We are using an old version of the API, 11.9 (also tried with some newer versions 17.4 - same result), because we have a lot of legacy XSLT’s which generate the old XML format, so updating to new XML format is not something that might be to hard to do right now.

PDF was generated using the old Aspose.Pdf.Generator.Pdf.BindXML. We’ve tried to update the dll’s to a later version, and start using the Aspose.Pdf.Document.BindXml, but with this Xml the Pdf turns out corrupt. And I was unable to find documentation on the changes needed to the XML so that it becomes supported in this new method.

Here is a very simple example we’ve made:

 <?xml version="1.0" encoding="utf-8"?>
 <Pdf OpenType="None" PageTransitionType="Dissolve" xsi:schemaLocation="Aspose.Pdf Aspose.Pdf.xsd" PageNumberFormatType="Arab" IsPageNumberRestarted="false" IsPageNumberForDocument="true" xmlns="Aspose.Pdf" xmlns:xsi="http://www w3.org/2001/XMLSchema-instance" xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <Section PageSize="A4" PageMarginBottom="2cm" PageMarginTop="2cm" PageMarginLeft="2cm" PageMarginRight="2cm" IsPageNumberRestarted="true">
     <FormField ID="formFieldTest" FieldName="formFieldTest" FormFieldType="Text" TextMaxLength="10" TextFontSize="12" TextFontName="Arial" FormWidth="100" />
   </Section>
 </Pdf>

We can access this field if we use other PDF reader modules, but creating an Aspose.Pdf.Document, the Form field it is empty.

Thanks in advance,
Paulo

@hh.paulo.silva

It is quite an older version of the API and all approaches it was using has been discontinued. We are afraid that we cannot apply any fix or provide documentation related to it. It is quite hard to track such an old logs of the API because they were simply discontinued and we decided to keep providing support on the basis of the latest available version of the API.

Nevertheless, we have logged an investigation ticket as PDFNET-54639 in our issue tracking system to analyze your request further and we will try to come up with some workaround (if possible). Otherwise, we are afraid that you will have to update your XML and XSLT as per the latest and new XML schema. We will let you know once the logged ticket is resolved. Please be patient and spare us some time.

We are sorry for your inconvenience.

Thanks for the response.

Now. If we wanted to the latest version, and update the XML to the latest structure XML Schema, how would we use the FormFields on it? https://docs.aspose.com/pdf/net/supported-xml-schema/ doesn’t have anything related to form fields, and I couldn’t find any sample with this.
Or is any documentation available on this structure migration?

Because if migration is doable, we would consider trying to do the upgrade, maybe sooner than expected. But we would need to make sure this can be done through XML. By this I mean use form fields and then read them on the API.

Thanks,
Paulo

@hh.paulo.silva

We definitely understand your concerns and we do agree with you. The purpose of opening an investigation ticket is that we either investigate a possibility to provide you a solution in existing version that you are using or we incorporate and make it available in the latest version of the API that is using new XML Schema. As soon as we have some results against our investigation, we will let you know in this forum thread.

We apologize for the inconvenience caused.

We have opted for a mixed solution, and have it working.

We are using an XLST to generate a PDF with string like tokens, which we then replace using a TextFragmentAbsorber with the form field in the right location. It is not perfect, but it is working.

Thanks

@hh.paulo.silva

It is good to know that you have sorted out your issue. Furthermore, we will surely let you know once this ticket is resolved.