MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
425 stars 51 forks source link

WebView2-Change PDF page programmatically (without reloading pdf document) #2409

Open DeniseTucker-eaton opened 2 years ago

DeniseTucker-eaton commented 2 years ago

Is your feature request related to a problem? Please describe. In our application, we currently use the webbrowser control to programmatically open a local PDF document and display a specific page. While the application is running, it programmatically changes the displayed page. This is done by accessing the document as IAcroAXDocShim and using setCurrentPage.

Describe the solution you'd like and alternatives you've considered With WebVIEW2, I have attempted to do this PDF display with a url and uri fragments. For example, C:\4Page_Example.pdf#toolbar=0&view=fitV&page=4 Then, change the Source and Refresh to: C:\4Page_Example.pdf#toolbar=0&view=fitV&page=8 However, the display will not change unless between each page change I additionally set and refresh the source to http://www.google.com.

Ideally, we could access the document like the DOM in webbrowser and then use it as IAcroAXDocShim and use setCurrentPage (and setShowToolbar, setPageMode, setLayoutMode, and setShowScrollbars)

AB#39322836

trebahl commented 2 weeks ago

This would be very useful for us too.

I would call it more a bug than a feature request, because navigating twice in a row to the same file with a different target page does not work the second time, it stays on the initial page.

As the OP stated, we need to use the ugly workaround of loading another page in between (BTW using NavigateToString("<html><body></body></html>") also works and is cleaner than loading google!). This means the pdf needs to be reloaded everytime, and the user sees flickering.