Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
Get the coordinate of click inside iframe (pdf)

I display pdf documents in an iframe on my website (all documents are stored in the same domain).

I would like users to be able to click in the document to add comments at a specific location. To do this, I am looking for a way to get the coordinate inside of an iframe (when we click).

It does not seem possible... However, there are paid solutions that offer this kind of functionality. Example : https://pdfjs.express/demo So, what process is used?

Thanks for you help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can get the coordinate of a click using the onmousedown event. The event gives you a MouseEvent object that contains the x and y coordinate of the click relative to the view port.

To get the coordinate relative to your iframe you have to subtract offsetLeft and offsetTop

Example

var iframe = document.getElementById("iframe")

onmousedown = function(e) {
    document.getElementById("position").textContent = "Mouse position: " + (e.clientX - iframe.offsetLeft) + " | " + (e.clientY - iframe.offsetTop)
}

Edit

You could use PDF.js and a canvas instead of a simple iframe to better controll the PDF-viewer.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda