I am trying to follow along with this post to show a PDF in a WebView2. I have set my WebView2 to dockstill "Fill", so it will use the entire space of the form.
The author recommends:
Dim html As String = "<!DOCTYPE html><html><head></head><body><div>" &
$"<iframe width=100% height=500 src=""data:Application/pdf;base64,{pdfBase64}"">" &
"</iframe></div></body></html>"
Me.WebView2.NavigateToString(html)
This works.
The PDF is displayed over the width of the webview / form and with 500 pixels in height.
However, I would like the iframe to be the size of the parent. To do that, I change "500" to "100%" like this:
Dim html As String = "<!DOCTYPE html><html><head></head><body><div>" &
$"<iframe width=100% height=100% src=""data:Application/pdf;base64,{pdfBase64}"">" &
"</iframe></div></body></html>"
This has no effect. Instead, the pdf that is shown in the iframe gets a height of 152 pixels.
What am I doing wrong?