Search results

View the hash id of the PDF document in React PDF Viewer component

02 Feb 2023 / 1 minute to read

View the PDF document’s id by passing the hashId value to the getItem() method of session storage API.

Refer to the following code to get the id of a PDF document in a button click.

Copied to clipboard
<button onclick="uniqueId()">UniqueId</button>

<script>
    //Event triggers when you click the UniqueId button.
    function uniqueId() {
        //Prints the PDF document id in the console window.
        console.log(window.sessionStorage.getItem("hashId"));
    }
</script>

View sample in GitHub.