@shyann
To get the scroll position of a PDF in an iframe, you can use JavaScript to access the iframe and get the scroll position of its content. Here's a step-by-step guide to achieving this:
1
|
const iframe = document.getElementById('your-iframe-id'); |
1
|
const doc = iframe.contentDocument || iframe.contentWindow.document; |
1 2 3 4 5 6 7 8 |
doc.addEventListener('scroll', function() { // Get the scroll position of the iframe content const scrollPosition = { x: doc.documentElement.scrollLeft, y: doc.documentElement.scrollTop }; console.log(scrollPosition); }); |
Make sure to replace 'your-iframe-id' with the actual ID of your iframe element in the code above. This code snippet will allow you to get the scroll position of a PDF document loaded in an iframe.