I am working on a WPF application where I use Webview2 to display PDF files. I rely on Edge's built in PDF rendering mechanism and am not using any external PDF libraries. I've successfully loaded the PDF using the following code:
PdfWebView.CoreWebView2.Navigate($"file:///{pdfFilePath.Replace("\", "/")}#toolbar=0");
Now I need to
- Retrieve the current page number of the PDF being viewed.
- Determine if the user is viewing the last page of the PDF
I haven't found any direct way to achieve this. I am aware we can execute JavaScript inside Webview2, but I don't think Edge PDF viewer exposes properties or methods (currentPageNumber, pagecount) that can help. Could someone guide me on this.
Any guidance or code examples would be greatly appreciated.
Thank you