WKWebview is not rendering .docx file accurately, docx contains logos in header and watermarks, which are not displayed

38 Views Asked by At

WKWebView is not rendering .docx file accurately. The docx file has logos in header and watermark at the background which is not displayed correctly to the user.

Getting the document data from a server using JSON encoded to Base64.

Steps taken to load the docx file in WKWebview:

  1. Stored the document data on app documents directory.
  2. Displaying the document file in WKWebView on mobile app with help of local document directory file path.

Below is the code that renders the docx file:

let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let filePath = String(format: "%@/%@", documentsPath, "file.docx")
                
let fileURL = URL(fileURLWithPath: filePath)
docWebView.loadFileURL(fileURL, allowingReadAccessTo: fileURL)

Has anyone encountered this issue?

0

There are 0 best solutions below