Conversion Adobe LC designed dynamic XFA form to standard

I am not able to view adobe LC XFA form in the IOS pdf viewer. So wanted to convert it into standard form before emailing it to customer.

I am getting below error while conversion:

Exception in thread “main” class com.aspose.pdf.internal.ms.System.z9: Value does not fall within the expected range.
com.aspose.pdf.internal.p215.z40.m2(Unknown Source)
com.aspose.pdf.internal.p216.z36.m1(Unknown Source)
com.aspose.pdf.Form.setType(Unknown Source)
com.iconectiv.utils.pdf.test.PdfConversionTest.main(PdfConversionTest.java:25)
at com.aspose.pdf.internal.p215.z40.m2(Unknown Source)

Here is the sample java code:

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import com.aspose.pdf.Document;
import com.aspose.pdf.FormType;

public class PdfConversionTest {
public static void main(String args[]) throws Exception
{
String templateFile = “output/invoice_67235.pdf”;
FileInputStream fs = null;
try {
fs = new FileInputStream(templateFile);
} catch (FileNotFoundException e) {
throw new Exception("Invoice Template File not found : "+templateFile, e);
}
Document pdfDocument = new Document(fs);
pdfDocument.getForm().setType(FormType.Standard);
pdfDocument.save(new FileOutputStream(“output/invoice_67235_10.pdf”));
try {
fs.close();
fs = null;
} catch (IOException e) {
throw new Exception("IOException while closing File stream : "+templateFile, e);
}
}

}

Attached is the pdf file which i tried to convert to standard one.

aspose-pdf-11.0.0.jar is used

Hi Amit,


Thanks
for using our API’s.
<o:p></o:p>

I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWJAVA-35365 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

@amody

Thanks for your patience.

We are pleased to inform you that earlier logged issue PDFJAVA-35365 has been resolved in Aspose.PDF for Java 18.1. Please download latest version of the API and in case of any issue, feel free to contact us.