Example of reading a local HTML file that includes a locally stored image, then rendering it all in WKWebView and finally exporting as PDF, all in Swift 5.
bvankuik/TestMakeAndPrintPDF
Example of reading a local HTML file, rendering in WKWebView and exporting as PDF
SwiftMIT