I'm glad we could get past that. hmmm, that is an interesting set of limitations you have. Perhaps you could do it the other way round and create the document online then export as pdf through the ctrl+p command? This could be achieved by setting up the whole thing in standard HTML +JS + CSS or you could use markdown/.md within the webpage. This would create a template which can just be filed in. If you have a list of information to be filed in from a .xls or something you can also format that as a JSON string in javascript and automate the creation of the documents as well. If the content is always the same (same number of fields/inputs), then this would be very easy to do.
Otherwise I would look at github.com etc and see if you could find any libraries or something that would do what you've built but with the formatting you need. Also, I applaud you on automating it :).
TheSheriff
Co-Founder, Founder, Entrepreneur & Problem Solver
Dude, you asked this on twitter less than an hour ago, give people time to answer stuff before spamming it in other places. Also try googling "export html text keep formatting" or something. What's the use case? Also, what about ctrl+p?
Also search through stackoverflow.com