Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I want to capture X and Y co-ordinates on pdf document loaded in iframe. This is an Asp.Net application in which I want to do this functinality.

Script code:
JavaScript
<script type="text/javascript">
        var msgDiv;
        function moveMouse() {
		
            e = window.frames.myFrame.event;
			var ef= e.view.outerWidth;
            msgDiv.innerHTML = "X: "+(e.x-205) + ", Y:" + (ef-e.y)+"  scroll:"+e.screenY +"  offset x:"+e.offsetX+"   "+e.offsetY+"  outerWidth:"+ef +"    win innerWidth:";          
		}
		
        function init() {
            msgDiv = document.getElementById("mPos");
            window.frames.myFrame.document.body.onmouseover = moveMouse;
        }


Design code:
HTML
<div class="op">Quote:</div><body>
   

        <div id="mPos"></div>
		<div class="iframeWrapper">
			<iframe name="myFrame" width="100%" height="1000" src="http://localhost/DESJARDINS_APPLICATION_FOR_ENROLMENT_FORM_9147A.pdf" onload="init()"></iframe>
		</div>
        
   
</body>


I am able to see X and Y co-ordinate on mouse over.
How to capture pointer position on click ?
Also the co-ordinates which displaying on mouse over are not correct, need correction to get exact co-ordinates.

-Avinash

What I have tried:

-Capture X and Y co-ordinates of document in iframe on click
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900