If you are able to do this on a Mac, you can load the html in a WKWebView and then use the function:
createPDF(configuration:completionHandler:)
https://developer.apple.com/documentation/webkit/wkwebview/c...:)