I am using Aspose.PDF for .NET and need to convert some PDF forms to HTML.
Hi Scott,
Thanks for your inquiry.
You can fill PDF form fields before converting PDF into HTML by Aspose.Pdf for .NET. This way, values of the fields will be preserved after converting to HTML. Please check following code snippet where I have filled the PDF which you have shared and converted it into HTML.
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir + “f1040.pdf”);
string[] names = pdfDocument.Form.XFA.FieldNames;
pdfDocument.Form.XFA[names[0]] = "Field 0";
pdfDocument.Form.XFA[names[1]] = "Field 1";
pdfDocument.Save(new MemoryStream());
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
pdfDocument.Save(dataDir + "HtmlOut.html", htmlOptions);
For your reference, I have also attached an output generated by above code snippet. For more information regarding filling form fields, please check “Working with XFA Forms” article in API documentation, as the PDF which you have shared, contains XFA Form Type. In case of any further assistance, please feel free to contact us.
Best Regards,
Thanks for the reply, but that’s not what I need to be able to do.
Hi Scott,