Can I convert an HTML form to a PDF?

Similar questions were asked on Stack Overflow on Jan 14, '14 by sneha and on Dec 1, '16 by SUNIL KUMAR E.U

In the previous chapters, we’ve created PDF documents by adding content to a page. It didn’t matter if we were adding high-level objects (e.g. a 'Paragraph') or low-level instructions (e.g. 'LineTo()', 'MoveTo()', 'Stroke'), iText converted everything to PDF syntax that was written to one or more content streams. In this chapter, we’ll add content of a different nature. We’ll add interactive features, known as annotations. Annotations aren’t part of the content stream. They are usually added on top of the existing content. There are many different types of annotations, many of which allow...
I am trying to cast AcroFields to the specific types so I can set properties on them. When I call AcroFields.GetField(string name); all I get is a string. When I call AcroFields.GetFieldItem(string name); I get an object but cannot cast it to the specific type.
I have a dynamic XFA Form that I can fill out manually using Adobe Acrobat on my computer. Using iTextSharp I can read what the XFA XML data is and see the structure of the data. But how can I fill out the form programmatically?
I want create a PDF template from another template. The resulting PDF should still be a template that I can fill out with data. I tried using PdfStamper but the resulting PDF is not template.
What techniques available to fill a PDF form automatically using external data and save them. I have to use data from a database to fill a template PDF and save a copy of it on disk with that data. Language and platform is not issue but it would be good if it can run on windows and Linux.
I have used iText to fill data into existing AcroForm fields in a PDF. I am now looking for a solution to add new AcroForm fields to a PDF. Is this possible with iText? If so, how can I do this?
Tags: XFAformsiText 7pdfXfa
Are there any issues that can come up of removing the XFA format from a PDF form? If I don't drop XFA, I can see the fields pre-filled on Acrobat Reader but not in Acrobat Pro. Other viewers like Ubuntu Document Viewer, present the file correctly. I don't mind dropping XFA but I'm just checking if there might be issues that I am not aware of.