简体   繁体   中英

Extract text coordinates from iframe

I want to select a region from an iframe and send the coordinates to the backend. More specifically what I want to do is let the user select an area from a file(pdf) where a table is present. How do I go about doing this?

Thanks for helping me

See https://github.com/tapmodo/Jcrop and it's demos.

<Iframe src="" id="frame"/>

And the script:

<script type="text/javascript">

jQuery(function($){

  $('#frame').Jcrop({
    onChange:   showCoords,
    onSelect:   showCoords
  });

});

// Simple event handler, called from onChange and onSelect
// event handlers to show an alert, as per the Jcrop 
// invocation above

function showCoords(c)
{
  alert('x='+ c.x +' y='+ c.y +' x2='+ c.x2 +' y2='+ c.y2)
  alert('w='+c.w +' h='+ c.h)
};

</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM