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.
<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>