The possible solution that I posted earlier has problems. The PDF file will open with an error from Drive, and there is a problem attaching it to an email.
The only solution that I can come up with is to save the HTML as an HTML file instead of a PDF file.
Saving the file as an HTML file will avoid errors that were preventing a file from being created. At least now a file will be created.
The HTML file can be opened in the browser, it can be opened by Google Docs, and it can be attached to an email.
With this new change, at least a file gets created, and the HTML file can be attached to an email.
If the person who gets the email clicks on the attachment, a new browser tab will open and the HTML will be displayed with it formatted the same as the PDF would look.
If you open the HTML file from your Drive, then you'll see all the HTML tags, but you can then open it in a Google Doc and the Google Doc will interpreted the HTML and display the content correctly.
You could then download the Google Doc as a PDF if you wanted to.