If I want to have a U.S. government tax form, like a W-9, be able to be filled out on my website, can I convert it to html (so that it looks as identical as possible to the original form), have the user fill it out, and then export the results to a pdf or image to submit to the IRS? Or does the thing that I submit to the IRS have to be a scan or physical copy of the pdf that the IRS provides?
There are no copyright restrictions, since tax forms are government works and statutorily not protected. The IRS in fact says that you can use a substantially identical form for W9, as long as you don't do certain things and do do other required things. You do not submit W-9 to the IRS, but they provide a document describing substitute tax forms. Basically, they say "The IRS accepts quality substitute tax forms that are consistent with the official forms and have no adverse impact on processing". You can't "just do it", without approval, but you might be able to get approval if your document follows the rules. If the output exactly reproduces the official form except for the parts which you must remove, then it would probably pass muster and it would not matter that the engine that you use is HTML. You can also remove the color screening -- read the rules to see what all is immutable vs. changeable.