Skip to content

How to grab page number when viewing PDF? #1812

Description

@dlanRT

I am trying to grab and save the page number of a PDF so that it can be saved and returned to when a user closes the WebView and returns. However at the moment when attempting to use the ExecuteScriptAsync command to run a 'getElementById' command all that gets returned is null. For any div ID I try to search. The command works just fine if run through dev tools in console, so the id is correct. I also noticed when just trying to return the 'document' all that gets returned is a JSON object that contains a hashed value and the path to the PDF file in question. Everything works fine if attempting this through a regular web page however. Is this just the behavior of the PDF Viewer?

To shorten my question, is there another way to grab the current page of a PDF in WebView2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions