Skip to content

Q: How to get perfect snapshot of WKWebview content #6

@codebeauty

Description

@codebeauty

I try to generate a perfect snapshot of the content of a WebView. The content is bigger than the screen and I get the size of the content handover by JS into the iOS app.

The following image shows a blue UIImageView with the snapshot. The green part is the body of HTML, fixed by setting width and height in JS the same width and height is handover into the app to set the WebView to the same size.

snap

The challenge is that I get a whitespace on the right and the bottom inside the snapshot. The whitespace is from the HTML content (tested by setting background-color in css).

I tried different methods of SnapshotKit for the WebView including scrollView. Any idea what I miss? How I can prevent the whitespace and clip it to a given size by JS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions